| 1 | package Games::EveOnline::EveCentral::Request::MarketStat; | ||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||
| 3 | 3 | $Games::EveOnline::EveCentral::Request::MarketStat::VERSION = '0.001'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Create a request for the marketstat 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 ArrayRef Int Str); | ||||||||||||||||||||||||||
|
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 => 'marketstat'; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 3 | has 'hours' => ( | |||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||
| 27 | isa => Int, | ||||||||||||||||||||||||||||
| 28 | default => 24 | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 3 | has 'type_id' => ( | |||||||||||||||||||||||||||
| 32 | is => 'ro', | ||||||||||||||||||||||||||||
| 33 | isa => AnyOf[Int, ArrayRef[Int]], | ||||||||||||||||||||||||||||
| 34 | required => 1 | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 3 | has 'min_q' => ( | |||||||||||||||||||||||||||
| 38 | is => 'ro', | ||||||||||||||||||||||||||||
| 39 | isa => Int, | ||||||||||||||||||||||||||||
| 40 | default => 1 | ||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 3 | has 'regions' => ( | |||||||||||||||||||||||||||
| 44 | is => 'ro', | ||||||||||||||||||||||||||||
| 45 | isa => AnyOf[Int, ArrayRef[Int]], | ||||||||||||||||||||||||||||
| 46 | default => -1 | ||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 3 | has 'system' => ( | |||||||||||||||||||||||||||
| 50 | is => 'ro', | ||||||||||||||||||||||||||||
| 51 | isa => Int, | ||||||||||||||||||||||||||||
| 52 | default => -1 | ||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 3 | has '_path' => ( | |||||||||||||||||||||||||||
| 56 | is => 'lazy', | ||||||||||||||||||||||||||||
| 57 | isa => Str, | ||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 2 | ▶ | sub request { | ||||||||||||||||||||||||||
|
Subroutine
request: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 64 | 2 | my $path = $self->_path; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 2 | return $self->http_request($path); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 5 | ▶ | sub _build__path { | ||||||||||||||||||||||||||
|
Subroutine
_build__path: called CC=11 SCAR=24.1
| |||||||||||||||||||||||||||||
| 72 | 5 | my $self = shift; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 5 | my $path = $ENDPOINT . '?'; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 5 | my $type_ids = $self->type_id; | |||||||||||||||||||||||||||
| 77 | 5 | ▶ | if (ref $type_ids eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 1 | for my $type_id (@$type_ids) { | |||||||||||||||||||||||||||
| 79 | 2 | $path .= "typeid=$type_id&"; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 1 | $path =~ s/&$//; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | else { | ||||||||||||||||||||||||||||
| 84 | 4 | $path .= "typeid=$type_ids"; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 5 | ▶ | if (defined $self->hours) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 5 | my $hours = $self->hours; | |||||||||||||||||||||||||||
| 89 | 5 | $path .= "&hours=$hours"; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 5 | ▶ | if (defined $self->min_q) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 5 | my $min_q = $self->min_q; | |||||||||||||||||||||||||||
| 94 | 5 | $path .= "&minQ=$min_q"; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 5 | my $system = $self->system; | |||||||||||||||||||||||||||
| 98 | 5 | ▶ | if (defined $system && $system > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $system and $system > 0
MC/DC50%1/2
defined $system and $system > 0
defined $system
$system > 0
Truth table66%2/3
A and B
A= defined $systemB= $system > 0
| |||||||||||||||||||||||||||||
| 99 | 1 | $path .= "&usesystem=$system"; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 5 | my $regions = $self->regions; | |||||||||||||||||||||||||||
| 103 | 5 | ▶ | if (defined $regions && $regions > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $regions and $regions > 0
MC/DC50%1/2
defined $regions and $regions > 0
defined $regions
$regions > 0
Truth table66%2/3
A and B
A= defined $regionsB= $regions > 0
| |||||||||||||||||||||||||||||
| 104 | 2 | ▶ | if (ref $regions eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 1 | for my $region (@$regions) { | |||||||||||||||||||||||||||
| 106 | 2 | $path .= "®ionlimit=$region"; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | else { | ||||||||||||||||||||||||||||
| 110 | 1 | $path .= "®ionlimit=$regions"; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 5 | return $path; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 3 | 1; # End of Games::EveOnline::EveCentral::Request::MarketStat | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | __END__ | ||||||||||||||||||||||||||||