EveCentral/Request/QuickLook.pm

filter: Statementstmt 100% 50 / 50 Branchbran 80.0% 8 / 10 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 92.4% 73 / 79 CC 9 SCAR 17.2
CC
9
Cov
94%
_build__path
9.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.6
« EveCentral/Request/MarketStat.pm ↑ Summary EveCentral/Request/History.pm »
1 package Games::EveOnline::EveCentral::Request::QuickLook;
2 {
3 3 $Games::EveOnline::EveCentral::Request::QuickLook::VERSION = '0.001';
4 }
5  
6  
7 # ABSTRACT: Create a request for the quicklook 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 => 'quicklook';
23  
24  
25 3 has 'hours' => (
26 is => 'ro',
27 isa => Int,
28 default => 360
29 );
30  
31 3 has 'type_id' => (
32 is => 'ro',
33 isa => 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 4 ▶sub _build__path {
Subroutine _build__path: called CC=9 SCAR=22.1
72 4 my $self = shift;
73  
74 4 my $path = $ENDPOINT . '?';
75  
76 4 $path .= 'typeid=' . $self->type_id;
77  
78 4 ▶ if (defined $self->hours) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->hours) 4 0 4
79 4 my $hours = $self->hours;
80 4 $path .= "&sethours=$hours";
81 }
82  
83 4 ▶ if (defined $self->min_q) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->min_q) 4 0 4
84 4 my $min_q = $self->min_q;
85 4 $path .= "&setminQ=$min_q";
86 }
87  
88 4 my $system = $self->system;
89 4 ▶ if (defined $system && $system > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $system and $system > 0) 1 3 4
Condition66%2/3
defined $system and $system > 0
!ll&&!rl&&r
031
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
ABresult
0X0
100
111
90 1 $path .= "&usesystem=$system";
91 }
92  
93 4 my $regions = $self->regions;
94 4 ▶ if (defined $regions && $regions > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $regions and $regions > 0) 2 2 4
Condition66%2/3
defined $regions and $regions > 0
!ll&&!rl&&r
022
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
ABresult
0X0
100
111
95 2 ▶ if (ref $regions eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $regions eq 'ARRAY') { } 1 1 2
96 1 for my $region (@$regions) {
97 2 $path .= "&regionlimit=$region";
98 }
99 }
100 else {
101 1 $path .= "&regionlimit=$regions";
102 }
103 }
104  
105 4 return $path;
106 }
107  
108  
109 3 1; # End of Games::EveOnline::EveCentral::Request::QuickLook
110  
111 __END__
« EveCentral/Request/MarketStat.pm ↑ Summary EveCentral/Request/History.pm »