line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
40
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
194
|
|
2
|
7
|
|
|
7
|
|
39
|
use warnings; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
189
|
|
3
|
7
|
|
|
7
|
|
33
|
use MRO::Compat 'c3'; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
273
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package WebService::Shippo::Collection; |
6
|
7
|
|
|
7
|
|
35
|
use Params::Callbacks ( 'callbacks' ); |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
341
|
|
7
|
7
|
|
|
7
|
|
37
|
use base ( 'WebService::Shippo::Resource' ); |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
3490
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub count |
10
|
|
|
|
|
|
|
{ |
11
|
0
|
|
|
0
|
0
|
|
my ( $invocant ) = @_; |
12
|
|
|
|
|
|
|
return $invocant->{count} |
13
|
0
|
0
|
|
|
|
|
if ref $invocant; |
14
|
0
|
|
|
|
|
|
return $invocant->all( results => 1 )->{count}; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub page_size |
18
|
|
|
|
|
|
|
{ |
19
|
0
|
|
|
0
|
0
|
|
my ( $invocant ) = @_; |
20
|
0
|
|
|
|
|
|
return scalar( @{ $invocant->{results} } ); |
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub next_page |
24
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant ) = &callbacks; |
26
|
0
|
0
|
|
|
|
|
return unless defined $invocant->{next}; |
27
|
0
|
|
|
|
|
|
my $response = WebService::Shippo::Request->get( $invocant->{next} ); |
28
|
0
|
|
|
|
|
|
return $invocant->item_class->construct_from( $response, $callbacks ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub plus_next_pages |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant ) = &callbacks; |
34
|
0
|
0
|
|
|
|
|
return $invocant unless defined $invocant->{next}; |
35
|
0
|
|
|
|
|
|
my $current = $invocant; |
36
|
0
|
|
|
|
|
|
while ( defined( $current->{next} ) ) { |
37
|
0
|
|
|
|
|
|
my $r = WebService::Shippo::Request->get( $current->{next} ); |
38
|
0
|
|
|
|
|
|
$current = $invocant->item_class->construct_from( $r, $callbacks ); |
39
|
0
|
|
|
|
|
|
push @{ $invocant->{results} }, @{ $current->{results} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
undef $invocant->{next}; |
42
|
0
|
|
|
|
|
|
return $invocant; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub previous_page |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant ) = &callbacks; |
48
|
0
|
0
|
|
|
|
|
return unless defined $invocant->{previous}; |
49
|
0
|
|
|
|
|
|
my $response = WebService::Shippo::Request->get( $invocant->{previous} ); |
50
|
0
|
|
|
|
|
|
return $invocant->item_class->construct_from( $response, $callbacks ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub plus_previous_pages |
54
|
|
|
|
|
|
|
{ |
55
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant ) = &callbacks; |
56
|
0
|
0
|
|
|
|
|
return $invocant unless defined $invocant->{previous}; |
57
|
0
|
|
|
|
|
|
my $current = $invocant; |
58
|
0
|
|
|
|
|
|
while ( defined( $current->{previous} ) ) { |
59
|
0
|
|
|
|
|
|
my $r = WebService::Shippo::Request->get( $current->{previous} ); |
60
|
0
|
|
|
|
|
|
$current = $invocant->item_class->construct_from( $r, $callbacks ); |
61
|
0
|
|
|
|
|
|
unshift @{ $invocant->{results} }, @{ $current->{results} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
undef $invocant->{previous}; |
64
|
0
|
|
|
|
|
|
return $invocant; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub items |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant ) = &callbacks; |
70
|
0
|
0
|
|
|
|
|
return $callbacks->transform( @{ $invocant->{results} } ) |
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
if wantarray; |
72
|
0
|
|
|
|
|
|
return [ $callbacks->transform( @{ $invocant->{results} } ) ]; |
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub item |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant, $position ) = &callbacks; |
78
|
|
|
|
|
|
|
return |
79
|
0
|
0
|
0
|
|
|
|
unless $position > 0 && $position <= $invocant->{count}; |
80
|
0
|
|
|
|
|
|
return $callbacks->smart_transform( $invocant->{results}[ $position - 1 ] ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub item_at_index |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
0
|
0
|
|
my ( $callbacks, $invocant, $index ) = &callbacks; |
86
|
0
|
|
|
|
|
|
return $callbacks->smart_transform( $invocant->{results}[$index] ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
BEGIN { |
90
|
7
|
|
|
7
|
|
53
|
no warnings 'once'; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
360
|
|
91
|
7
|
|
|
7
|
|
16
|
*Shippo::Collection:: = *WebService::Shippo::Collection::; |
92
|
7
|
|
|
|
|
186
|
*to_array = *items; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |