line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Amazon::PAApi5::Payload; |
2
|
1
|
|
|
1
|
|
68961
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
608
|
use String::CamelCase qw/decamelize/; |
|
1
|
|
|
|
|
610
|
|
|
1
|
|
|
|
|
89
|
|
6
|
1
|
|
|
1
|
|
817
|
use JSON qw//; |
|
1
|
|
|
|
|
13520
|
|
|
1
|
|
|
|
|
34
|
|
7
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
8
|
1
|
|
|
|
|
7
|
rw => [qw/ |
9
|
|
|
|
|
|
|
partner_tag |
10
|
|
|
|
|
|
|
marketplace |
11
|
|
|
|
|
|
|
partner_type |
12
|
|
|
|
|
|
|
/], |
13
|
1
|
|
|
1
|
|
524
|
); |
|
1
|
|
|
|
|
923
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
2
|
|
|
2
|
1
|
1704
|
my $class = shift; |
17
|
2
|
50
|
|
|
|
8
|
my $partner_tag = shift or croak 'partner_tag is required'; |
18
|
2
|
|
50
|
|
|
11
|
my $marketplace = shift || 'www.amazon.com'; |
19
|
2
|
|
50
|
|
|
8
|
my $opt = shift || {}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return bless { |
22
|
|
|
|
|
|
|
partner_tag => $partner_tag, |
23
|
|
|
|
|
|
|
marketplace => $marketplace, |
24
|
2
|
|
50
|
|
|
25
|
partner_type => $opt->{partner_type} || 'Associates', |
25
|
|
|
|
|
|
|
}, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub to_json { |
29
|
2
|
|
|
2
|
1
|
593
|
my ($self, $data) = @_; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
5
|
my $hash = {}; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
4
|
for my $k (keys %{$data}) { |
|
2
|
|
|
|
|
8
|
|
34
|
5
|
|
|
|
|
11
|
$hash->{$k} = $data->{$k}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
5
|
for my $k (qw/ |
38
|
|
|
|
|
|
|
PartnerTag |
39
|
|
|
|
|
|
|
Marketplace |
40
|
|
|
|
|
|
|
PartnerType |
41
|
|
|
|
|
|
|
/) { |
42
|
6
|
|
|
|
|
34
|
my $method = decamelize($k); |
43
|
6
|
|
|
|
|
197
|
$hash->{$k} = $self->$method; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
17
|
return JSON::to_json($hash, { utf8 => 0, canonical => 1 }); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |