| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Easypost::CustomsInfo; |
|
2
|
|
|
|
|
|
|
$Net::Easypost::CustomsInfo::VERSION = '0.23'; |
|
3
|
1
|
|
|
1
|
|
401
|
use JSON::MaybeXS; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
63
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Types::Standard qw(ArrayRef Bool Enum InstanceOf Str); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
846
|
use Moo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
7
|
|
|
|
|
|
|
with qw/Net::Easypost::Resource/; |
|
8
|
|
|
|
|
|
|
with qw/Net::Easypost::PostOnBuild/; |
|
9
|
1
|
|
|
1
|
|
334
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'eel_ppc' => ( |
|
12
|
|
|
|
|
|
|
is => 'rw', |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'contents_type' => ( |
|
16
|
|
|
|
|
|
|
is => 'rw', |
|
17
|
|
|
|
|
|
|
isa => Enum[qw/documents gift merchandise returned_goods sample other/] |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'customs_certify' => ( |
|
21
|
|
|
|
|
|
|
is => 'rw', |
|
22
|
|
|
|
|
|
|
isa => Bool|InstanceOf['JSON::PP::Boolean'], |
|
23
|
|
|
|
|
|
|
coerce => sub { $_[0] ? JSON->true : JSON->false } |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'non_delivery_option' => ( |
|
27
|
|
|
|
|
|
|
is => 'rw', |
|
28
|
|
|
|
|
|
|
isa => Enum[qw/abandon return/], |
|
29
|
|
|
|
|
|
|
default => 'return' |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has [qw/contents_explanation customs_signer/] => ( |
|
33
|
|
|
|
|
|
|
is => 'rw', |
|
34
|
|
|
|
|
|
|
isa => Str |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'restriction_type' => ( |
|
38
|
|
|
|
|
|
|
is => 'rw', |
|
39
|
|
|
|
|
|
|
isa => Enum[qw/none quarantine sanitary_phytosanitary_inspection/] |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'restriction_comments' => ( |
|
43
|
|
|
|
|
|
|
is => 'rw', |
|
44
|
|
|
|
|
|
|
isa => Str |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has 'customs_items' => ( |
|
48
|
|
|
|
|
|
|
is => 'rw', |
|
49
|
|
|
|
|
|
|
isa => ArrayRef[InstanceOf['Net::Easypost::CustomsItem']] |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _build_fieldnames { |
|
53
|
|
|
|
|
|
|
return [ |
|
54
|
1
|
|
|
1
|
|
216
|
qw/ |
|
55
|
|
|
|
|
|
|
contents_explanation |
|
56
|
|
|
|
|
|
|
contents_type |
|
57
|
|
|
|
|
|
|
customs_certify |
|
58
|
|
|
|
|
|
|
customs_signer |
|
59
|
|
|
|
|
|
|
eel_ppc |
|
60
|
|
|
|
|
|
|
non_delivery_option |
|
61
|
|
|
|
|
|
|
restriction_comments |
|
62
|
|
|
|
|
|
|
restriction_type |
|
63
|
|
|
|
|
|
|
/ |
|
64
|
|
|
|
|
|
|
]; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
1
|
|
|
1
|
|
177
|
sub _build_role { 'customs_info' } |
|
67
|
1
|
|
|
1
|
|
34
|
sub _build_operation { '/customs_infos' } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub serialize { |
|
70
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $obj = { |
|
73
|
6
|
|
|
|
|
117
|
map { $self->role . "[$_]" => $self->$_ } |
|
74
|
1
|
|
|
|
|
3
|
grep { defined $self->$_ } @{ $self->fieldnames } |
|
|
8
|
|
|
|
|
171
|
|
|
|
1
|
|
|
|
|
5
|
|
|
75
|
|
|
|
|
|
|
}; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# if customs_items exist, they were already created in Net::Easypost::CustomsItem |
|
78
|
|
|
|
|
|
|
# so we can simply pass the id |
|
79
|
1
|
50
|
|
|
|
25
|
if ($self->customs_items) { |
|
80
|
1
|
|
|
|
|
9
|
foreach my $i (0 .. $#{ $self->customs_items }) { |
|
|
1
|
|
|
|
|
14
|
|
|
81
|
1
|
|
|
|
|
20
|
my $item = $self->customs_items->[$i]; |
|
82
|
1
|
|
|
|
|
13
|
$obj->{$self->role . "[customs_items][$i][id]"} = $item->id; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
7
|
return $obj; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub clone { |
|
90
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
return Net::Easypost::CustomsInfo->new( |
|
93
|
0
|
|
|
|
|
|
map { $_ => $self->$_ } |
|
94
|
0
|
|
|
|
|
|
grep { defined $self->$_ } @{ $self->fieldnames }, |
|
|
0
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
'customs_items' => [ |
|
96
|
0
|
|
|
|
|
|
map { $_->clone } $self->customs_items |
|
|
0
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
] |
|
98
|
|
|
|
|
|
|
); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |