| 1 | package Games::EveOnline::EveCentral::Request::History; | ||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||
| 3 | 3 | $Games::EveOnline::EveCentral::Request::History::VERSION = '0.001'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Create a request for the history endpoint. | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Moo 1.003001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use MooX::Types::MooseLike 0.25; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use MooX::StrictConstructor 0.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use MooX::Types::MooseLike::Base qw(AnyOf Enum Int Str Undef); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use 5.012; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 3 | extends 'Games::EveOnline::EveCentral::Request'; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use Readonly 1.03; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 3 | Readonly::Scalar my $ENDPOINT => 'history'; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 3 | has 'type_id' => ( | |||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||
| 27 | isa => Int, | ||||||||||||||||||||||||||||
| 28 | required => 1 | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 3 | has 'location_type' => ( | |||||||||||||||||||||||||||
| 32 | is => 'ro', | ||||||||||||||||||||||||||||
| 33 | isa => Enum['system', 'region'], | ||||||||||||||||||||||||||||
| 34 | predicate => 1 | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 3 | has 'location' => ( | |||||||||||||||||||||||||||
| 38 | is => 'ro', | ||||||||||||||||||||||||||||
| 39 | isa => AnyOf[Int, Str] | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 3 | has 'bid' => ( | |||||||||||||||||||||||||||
| 43 | is => 'ro', | ||||||||||||||||||||||||||||
| 44 | isa => Enum['buy', 'sell'], | ||||||||||||||||||||||||||||
| 45 | required => 1 | ||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | has '_path' => ( | |||||||||||||||||||||||||||
| 49 | is => 'lazy', | ||||||||||||||||||||||||||||
| 50 | isa => Str, | ||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 2 | ▶ | sub request { | ||||||||||||||||||||||||||
|
Subroutine
request: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 57 | 2 | my $path = $self->_path; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 2 | return $self->http_request($path); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 9 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | 9 | my $location = $self->location; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 9 | ▶ | if ($self->has_location_type()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 6 | ▶ | if (not defined $location or $location eq '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $location or $location eq ""
MC/DC50%1/2
not defined $location or $location eq ""
not defined $location
$location eq ""
Truth table66%2/3
not(A) or B
A= not defined $locationB= $location eq ""
| |||||||||||||||||||||||||||||
| 70 | 1 | die "Location must be provided."; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 5 | ▶ | sub _build__path { | ||||||||||||||||||||||||||
|
Subroutine
_build__path: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 76 | 5 | my $self = shift; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 5 | my $path = $ENDPOINT . '/'; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 5 | $path .= 'for/type/' . $self->type_id; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 5 | ▶ | if (defined $self->location_type) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 3 | $path .= '/' . $self->location_type; | |||||||||||||||||||||||||||
| 84 | 3 | $path .= '/' . $self->location; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 5 | ▶ | my $bid = $self->bid eq 'buy'? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 5 | $path .= '/bid/' . $bid; | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 5 | return $path; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 3 | 1; # End of Games::EveOnline::EveCentral::Request::History | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | __END__ | ||||||||||||||||||||||||||||