line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package Business::UPS::Tracking::Element::Activity; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
1
|
|
|
1
|
|
4840
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
63
|
use 5.0100; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
611
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw(Business::UPS::Tracking::Role::Print |
9
|
|
|
|
|
|
|
Business::UPS::Tracking::Role::Builder); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
no if $] >= 5.017004, warnings => qw(experimental::smartmatch); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Business::UPS::Tracking::Utils; |
14
|
|
|
|
|
|
|
use Business::UPS::Tracking::Element::Activity; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=encoding utf8 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Business::UPS::Tracking::Element::Activity - A small freight package activity |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This class represents an small freight package activity. Usually it is created |
25
|
|
|
|
|
|
|
automatically from a L<Business::UPS::Tracking::Element::Package> object. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 ACCESSORS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 xml |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Original L<XML::LibXML::Node> node. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 ActivityLocationAddress |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
A L<Business::UPS::Tracking::Element::Address> object representing the |
36
|
|
|
|
|
|
|
location of the activity. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 ActivityLocation |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Type of location. |
41
|
|
|
|
|
|
|
Returns a L<Business::UPS::Tracking::Element::Code> object. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 SignedForByName |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 StatusCode |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 StatusType |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Status code. |
50
|
|
|
|
|
|
|
Returns a L<Business::UPS::Tracking::Element::Code> object. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 DateTime |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L<DateTime> object. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has 'xml' => ( |
59
|
|
|
|
|
|
|
is => 'ro', |
60
|
|
|
|
|
|
|
isa => 'XML::LibXML::Node', |
61
|
|
|
|
|
|
|
required => 1, |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has 'ActivityLocationAddress' => ( |
65
|
|
|
|
|
|
|
is => 'ro', |
66
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Address]', |
67
|
|
|
|
|
|
|
traits => ['Printable'], |
68
|
|
|
|
|
|
|
documentation => 'Address', |
69
|
|
|
|
|
|
|
lazy_build => 1, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
has 'ActivityLocation' => ( |
72
|
|
|
|
|
|
|
is => 'ro', |
73
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Code]', |
74
|
|
|
|
|
|
|
traits => ['Printable'], |
75
|
|
|
|
|
|
|
lazy_build => 1, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
has 'SignedForByName' => ( |
78
|
|
|
|
|
|
|
is => 'ro', |
79
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
80
|
|
|
|
|
|
|
traits => ['Printable'], |
81
|
|
|
|
|
|
|
lazy_build => 1, |
82
|
|
|
|
|
|
|
documentation => 'Signed by', |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
has 'StatusCode' => ( |
85
|
|
|
|
|
|
|
is => 'ro', |
86
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
87
|
|
|
|
|
|
|
lazy_build => 1, |
88
|
|
|
|
|
|
|
traits => ['Printable'], |
89
|
|
|
|
|
|
|
documentation => 'Satus code', |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
# MP ... Billing information |
92
|
|
|
|
|
|
|
# OR ... Original scan |
93
|
|
|
|
|
|
|
# DP ... Departure scan |
94
|
|
|
|
|
|
|
# AR ... Arival scan |
95
|
|
|
|
|
|
|
# LC ... Location scan |
96
|
|
|
|
|
|
|
# KS/KR ... Annahmeverweigerung |
97
|
|
|
|
|
|
|
# KM/KB ... Anlieferung (Bounce?) |
98
|
|
|
|
|
|
|
# 48 ... Failed 1st atempt |
99
|
|
|
|
|
|
|
# KX ... Failed 2nd atempt |
100
|
|
|
|
|
|
|
# 49 ... Failed 3rd atempt |
101
|
|
|
|
|
|
|
# UL ... Unload scan |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
has 'StatusType' => ( |
104
|
|
|
|
|
|
|
is => 'ro', |
105
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Code]', |
106
|
|
|
|
|
|
|
traits => ['Printable'], |
107
|
|
|
|
|
|
|
lazy_build => 1, |
108
|
|
|
|
|
|
|
documentation => 'Status', |
109
|
|
|
|
|
|
|
); |
110
|
|
|
|
|
|
|
has 'DateTime' => ( |
111
|
|
|
|
|
|
|
is => 'ro', |
112
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Type::Date]', |
113
|
|
|
|
|
|
|
traits => ['Printable'], |
114
|
|
|
|
|
|
|
lazy_build => 1, |
115
|
|
|
|
|
|
|
documentation => 'Date/time', |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _build_DateTime { |
119
|
|
|
|
|
|
|
my ($self) = @_; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $datestr = $self->xml->findvalue('Date'); |
122
|
|
|
|
|
|
|
my $date = Business::UPS::Tracking::Utils::parse_date($datestr); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $timestr = $self->xml->findvalue('Time'); |
125
|
|
|
|
|
|
|
return Business::UPS::Tracking::Utils::parse_time( $timestr, $date ); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub _build_StatusType { |
129
|
|
|
|
|
|
|
my ($self) = @_; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
return $self->build_code('Status/StatusType'); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _build_StatusCode { |
135
|
|
|
|
|
|
|
my ($self) = @_; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
return $self->xml->findvalue('Status/StatusCode/Code'); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _build_ActivityLocationAddress { |
141
|
|
|
|
|
|
|
my ($self) = @_; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
return $self->build_address('ActivityLocation/Address' ); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub _build_ActivityLocation { |
147
|
|
|
|
|
|
|
my ($self) = @_; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
return $self->build_code('ActivityLocation' ); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub _build_SignedForByName { |
153
|
|
|
|
|
|
|
my ($self) = @_; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
return $self->xml->findvalue('ActivityLocation/SignedForByName'); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 METHODS |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 Status |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Translates the L<StatusTypeCode> to a short description. Can return |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=over |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item * In Transit |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * Delivered |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item * Exeption |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * Pickup |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item * Manifest Pickup |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * Unknown |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=back |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub Status { |
183
|
|
|
|
|
|
|
my ($self) = @_; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
given ($self->StatusType->Code) { |
186
|
|
|
|
|
|
|
when ('I') { |
187
|
|
|
|
|
|
|
return 'In Transit'; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
when ('D') { |
190
|
|
|
|
|
|
|
return 'Delivered'; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
when ('X') { |
193
|
|
|
|
|
|
|
return 'Exeption'; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
when ('P') { |
196
|
|
|
|
|
|
|
return 'Pickup'; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
when ('M') { |
199
|
|
|
|
|
|
|
return 'Manifest Pickup'; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
default { |
202
|
|
|
|
|
|
|
return 'Unknown'; |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 meta |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Moose meta method |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
214
|
|
|
|
|
|
|
no Moose; |
215
|
|
|
|
|
|
|
1; |