EveCentral/Request/History.pm

filter: Statementstmt 100% 44 / 44 Branchbran 100% 8 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 9 / 9 Podpod 50.0% 1 / 2 totaltotal 95.5% 65 / 68 CC 6 SCAR 8.3
CC
6
Cov
98%
BUILD
4.0
_build__path
3.0
BEGIN
1.0
CRAP 2.3
« EveCentral/Request/QuickLook.pm ↑ Summary EveCentral/Request.pm »
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
BranchTrueFalseTotal
if ($self->has_location_type) 6 3 9
69 6 ▶ if (not defined $location or $location eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $location or $location eq "") 1 5 6
Condition66%2/3
not defined $location or $location eq ""
l!l&&r!l&&!r
105
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 ""
ABresult
1X1
011
000
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
BranchTrueFalseTotal
if (defined $self->location_type) 3 2 5
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
BranchTrueFalseTotal
$self->bid eq 'buy' ? : 3 2 5
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__
« EveCentral/Request/QuickLook.pm ↑ Summary EveCentral/Request.pm »