Skip to content

Commit

Permalink
Version 0.165_02
Browse files Browse the repository at this point in the history
Set version to 0.165_02. Update Changes file for changes since v00.165_01.
  • Loading branch information
trwyant committed Jun 7, 2024
1 parent e144e8b commit c480a31
Show file tree
Hide file tree
Showing 50 changed files with 268 additions and 791 deletions.
7 changes: 7 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.165_02 2024-06-07 T. R. Wyant
Correct celestrak_supplemental() bad catalog status. The previous
was the oxymoronic '400 OK'. The intended (and now implemented) is
404 with a custom error message.

Add back Celestrak SES supplemental data.

0.165_01 2024-05-19 T. R. Wyant
Add Project Kuiper to Celestrak supplemental data.

Expand Down
34 changes: 1 addition & 33 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,7 @@ README
script/SpaceTrack
t/basic.t
t/complete.t
t/data/Mock-LWP-UserAgent/0437d2e149ca0e1160cd2a16ccdb14c8.json
t/data/Mock-LWP-UserAgent/045b03a220507df9fdf388a891da2426.json
t/data/Mock-LWP-UserAgent/0b668732d3fe9ef6563405784241e276.json
t/data/Mock-LWP-UserAgent/14863e88ba6c24b31b7c80b871c9d683.json
t/data/Mock-LWP-UserAgent/2826f5a8728a9680cc005ca232c785f3.json
t/data/Mock-LWP-UserAgent/2bf6cbea8c948fdc380f054f6876be62.json
t/data/Mock-LWP-UserAgent/3b6c784d727fd21b492450c38e7f435a.json
t/data/Mock-LWP-UserAgent/4157693ffa705165e0c3767b46589ff2.json
t/data/Mock-LWP-UserAgent/49dbbf24c48e757b29f962fc11804b10.json
t/data/Mock-LWP-UserAgent/576741fc0ec515d2c58695aa01f39c7e.json
t/data/Mock-LWP-UserAgent/5d4888f0d5eab05762ab3cc9c55a1054.json
t/data/Mock-LWP-UserAgent/649a9eb97c409b5558fc137929c4faf4.json
t/data/Mock-LWP-UserAgent/678f14510aa9bb932530afdbad0a5548.json
t/data/Mock-LWP-UserAgent/77a70d912074e3555e681e468619566c.json
t/data/Mock-LWP-UserAgent/77def4150f6184f1e31ea44a253b44aa.json
t/data/Mock-LWP-UserAgent/82e3117ae36d00ffb47ecb67f5270212.json
t/data/Mock-LWP-UserAgent/84c1082e789616a71e9870bb5bd3dd66.json
t/data/Mock-LWP-UserAgent/8bd8451a5cb8012b60e73ba5afa55c74.json
t/data/Mock-LWP-UserAgent/8ce3a50c591cd25a489c5f6369cab0c4.json
t/data/Mock-LWP-UserAgent/987ed1b49be9b63eafb22cc01773598b.json
t/data/Mock-LWP-UserAgent/a80078680e21548c9e3c417fb594f345.json
t/data/Mock-LWP-UserAgent/aa9040dde43f97d323ffcad791dc93b0.json
t/data/Mock-LWP-UserAgent/b4d797961378fb12f19289628230ca73.json
t/data/Mock-LWP-UserAgent/bb37594fa234c7136af5dbd91cabb032.json
t/data/Mock-LWP-UserAgent/bb82186b6f19e5063306263f81df83de.json
t/data/Mock-LWP-UserAgent/c0e91e4494b928e0b3573492d9595e24.json
t/data/Mock-LWP-UserAgent/ca444012a1e6ed61e77dbbc24868e2b4.json
t/data/Mock-LWP-UserAgent/cabd965af88e3e4a5441e8abe9b72130.json
t/data/Mock-LWP-UserAgent/cb4c54b6e0e33bcf199f4af9432941a9.json
t/data/Mock-LWP-UserAgent/cdb6ebbf154b1079c0316c899dbebb96.json
t/data/Mock-LWP-UserAgent/d0d6d1770700cde752f3d33e4aef43d7.json
t/data/Mock-LWP-UserAgent/e271c40aa2ddee7e17ee18b8987ae99f.json
t/data/Mock-LWP-UserAgent/ecef6b565d11dadf7b8457118813d872.json
t/data/Mock-LWP-UserAgent/resp.json
t/file.dat
t/query_amsat.t
t/query_celestrak.t
Expand Down
2 changes: 1 addition & 1 deletion eg/SpaceTrackTk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use IO::File;
use Tk;
use Tk::Pane;

our $VERSION = '0.165_01';
our $VERSION = '0.165_02';

my @pad = qw{ -padx 5 -pady 5 }; # Standard cell padding

Expand Down
2 changes: 1 addition & 1 deletion eg/celestrak
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use strict;
use warnings;

our $VERSION = '0.165_01';
our $VERSION = '0.165_02';

use Astro::SpaceTrack;

Expand Down
2 changes: 1 addition & 1 deletion eg/spacetrack-identity
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Getopt::Long 2.33 qw{ :config auto_version };
use Astro::SpaceTrack;
use Pod::Usage;

our $VERSION = '0.165_01';
our $VERSION = '0.165_02';

my %opt;

Expand Down
98 changes: 67 additions & 31 deletions inc/Astro/SpaceTrack/Dumper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,55 @@ use Carp;
use JSON;

use Astro::SpaceTrack;
use HTTP::Response;
use HTTP::Status qw{ HTTP_OK };
our @ISA = qw{ Astro::SpaceTrack };

eval {
local @INC = @INC;
require lib;
lib->import( 'inc' );
require Mock::LWP::UserAgent;
1;
} or croak 'Can not load Mock::LWP::UserAgent. Code must be run from the base directory of the Astro-SpaceTrack distribution';
# NOTE that these live in inc/, but so does this module, so we assume
# inc/ is already in @INC.

our $VERSION = '0.165_01';
use Mock::LWP::UserAgent;
use My::Module::Test;

our $VERSION = '0.165_02';

sub new {
my ( $class, %arg ) = @_;
local $Mock::LWP::UserAgent::CANNED_RESPONSE_FILE = delete
$arg{canned_response_file};
my $self = $class->SUPER::new( %arg );
$self->{ +__PACKAGE__ } = Mock::LWP::UserAgent::__load_data(
optional => 1,
);
return $self;
}

sub site_check {
my ( $self, $site ) = @_;
my $uri = My::Module::Test::__site_to_check_uri( $site )
or die "No check URI for site '$site'\n";
return $self->_get_from_net( url => $uri );
}

sub _readline_complete_command_site_check {
# my ( $self, $text, $line, $start, $cmd_line ) = @_;
my ( $self, $text ) = @_;
my @sites = My::Module::Test::__site_codes();
$text eq ''
and return @sites;
my $re = qr/ \A \Q$text\E /smx;
return grep { $_ =~ $re } @sites;
}

sub request {
my ( $self, $method, $uri ) = @_;
defined $uri
or ( $method, $uri ) = ( GET => $method );
return $self->_get_from_net(
method => uc $method,
url => $uri,
);
}

{
my $json;
Expand Down Expand Up @@ -110,15 +148,6 @@ sub _censor_tle { ## no critic (ProhibitUnusedPrivateSubroutines)
my $method = $rqst->method();
my $url = $rqst->url();

my $path = Mock::LWP::UserAgent::__file_name_for( $method, $url );
-e $path
and return;

my $dump_flags = $self->getv( 'dump_headers' );
$dump_flags & $self->DUMP_RESPONSE
and warn "Creating $path\n";

$json ||= JSON->new()->utf8()->pretty()->canonical();
$censors ||= _list_censors();
my $content = $resp->content();
foreach my $code ( @{ $censors } ) {
Expand All @@ -138,21 +167,32 @@ sub _censor_tle { ## no critic (ProhibitUnusedPrivateSubroutines)
_dump_header_item( $resp, 'Status' ),
],
$content,
{
method => $method,
uri => '' . $url, # Stringify
},
);

open my $fh, '>:encoding(utf-8)', $path
or die "Unable to open $path: $!\n";
print { $fh } $json->encode( \@data );
close $fh;
Mock::LWP::UserAgent::__modify_data(
$self->{ +__PACKAGE__ }, $url, $method, \@data );

return;
}
}

sub list {
my ( $self ) = @_;
my $data = $self->{ +__PACKAGE__ }{data};
my @content;
foreach my $url ( sort keys %{ $data } ) {
foreach my $method ( sort keys %{ $data->{$url} } ) {
push @content, "$method $url\r\n";
}
}
return HTTP::Response->new(
HTTP_OK,
undef,
undef,
join( '', @content ),
);
}

sub _dump_header_item {
my ( $resp, $name, $override ) = @_;
my @value = $resp->header( $name )
Expand Down Expand Up @@ -223,17 +263,13 @@ This class supports the following protected methods:
$st->__dump_response( $resp );
This override of the superclass' method unconditionally checks the
C<Mock::LWP::UserAgent> data directory to see if the
C<HTTP::Response|HTTP::Response> object is represented there. If not, it
is written. If the C<DUMP_HEADERS> bit is set, a message is written to
standard error before a new file is created.
This override of the superclass' method adds the given response to the
C<Mock::LWP::UserAgent> data file.
=head1 ATTRIBUTES
This class has no additional attributes.
=head1 SEE ALSO
L<Astro::SpaceTrack|Astro::SpaceTrack>.
Expand Down
Loading

0 comments on commit c480a31

Please sign in to comment.