| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ============================================================================ |
|
2
|
|
|
|
|
|
|
package Business::UPS::Tracking::Shipment; |
|
3
|
|
|
|
|
|
|
# ============================================================================ |
|
4
|
1
|
|
|
1
|
|
4969
|
use utf8; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
5
|
1
|
|
|
1
|
|
59
|
use 5.0100; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
45
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
578
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw(Business::UPS::Tracking::Role::Print |
|
9
|
|
|
|
|
|
|
Business::UPS::Tracking::Role::Builder); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Business::UPS::Tracking::Utils; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=encoding utf8 |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Business::UPS::Tracking::Shipment - Base class for shipments |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This class is a base class for |
|
22
|
|
|
|
|
|
|
L<Business::UPS::Tracking::Shipment::SmallPackage> and |
|
23
|
|
|
|
|
|
|
L<Business::UPS::Tracking::Shipment::Freight>. Usually it is created |
|
24
|
|
|
|
|
|
|
automatically from a L<Business::UPS::Tracking::Response> object. It provides |
|
25
|
|
|
|
|
|
|
accessors common to all shipment types. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 xml |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
L<XML::LibXML::Node> node of the shipment. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 ScheduledDelivery |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Scheduled delivery date and time. Returns a L<DateTime> object. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 PickupDate |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Pickup date. Returns a L<DateTime> object. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 ShipperNumber |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Shipper UPS customer number. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 ShipperAddress |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Shipper address. Returns a L<Business::UPS::Tracking::Element::Address> |
|
48
|
|
|
|
|
|
|
object. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 ShipmentWeight |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Shipment weight. Returns a L<Business::UPS::Tracking::Element::Weight> |
|
53
|
|
|
|
|
|
|
object. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 ShipToAddress |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Shipment destination address. Returns a |
|
58
|
|
|
|
|
|
|
L<Business::UPS::Tracking::Element::Address> object. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 Service |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Service code and description. |
|
63
|
|
|
|
|
|
|
Returns a L<Business::UPS::Tracking::Element::Code> object. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 ShipmentReferenceNumber |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Reference number for the whole shipment as provided by the shipper. Returns a |
|
68
|
|
|
|
|
|
|
L<Business::UPS::Tracking::Element::ReferenceNumber> object. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
has 'xml' => ( |
|
73
|
|
|
|
|
|
|
is => 'ro', |
|
74
|
|
|
|
|
|
|
required=> 1, |
|
75
|
|
|
|
|
|
|
isa => 'XML::LibXML::Node', |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
has 'ScheduledDelivery' => ( |
|
78
|
|
|
|
|
|
|
is => 'ro', |
|
79
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Type::Date]', |
|
80
|
|
|
|
|
|
|
traits => ['Printable'], |
|
81
|
|
|
|
|
|
|
lazy_build => 1, |
|
82
|
|
|
|
|
|
|
documentation => 'Scheduled delivery date', |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
has 'PickupDate' => ( |
|
85
|
|
|
|
|
|
|
is => 'ro', |
|
86
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Type::Date]', |
|
87
|
|
|
|
|
|
|
traits => ['Printable'], |
|
88
|
|
|
|
|
|
|
documentation => 'Pickup date', |
|
89
|
|
|
|
|
|
|
lazy_build => 1, |
|
90
|
|
|
|
|
|
|
); |
|
91
|
|
|
|
|
|
|
has 'ShipperNumber' => ( |
|
92
|
|
|
|
|
|
|
is => 'ro', |
|
93
|
|
|
|
|
|
|
isa => 'Str', |
|
94
|
|
|
|
|
|
|
traits => ['Printable'], |
|
95
|
|
|
|
|
|
|
documentation => 'Shipper UPS customer number', |
|
96
|
|
|
|
|
|
|
lazy_build => 1, |
|
97
|
|
|
|
|
|
|
); |
|
98
|
|
|
|
|
|
|
has 'ShipperAddress' => ( |
|
99
|
|
|
|
|
|
|
is => 'ro', |
|
100
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Address]', |
|
101
|
|
|
|
|
|
|
traits => ['Printable'], |
|
102
|
|
|
|
|
|
|
documentation => 'Shipper address', |
|
103
|
|
|
|
|
|
|
lazy_build => 1, |
|
104
|
|
|
|
|
|
|
); |
|
105
|
|
|
|
|
|
|
has 'ShipmentWeight' => ( |
|
106
|
|
|
|
|
|
|
is => 'ro', |
|
107
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Weight]', |
|
108
|
|
|
|
|
|
|
traits => ['Printable'], |
|
109
|
|
|
|
|
|
|
documentation => 'Shipment weight', |
|
110
|
|
|
|
|
|
|
lazy_build => 1, |
|
111
|
|
|
|
|
|
|
); |
|
112
|
|
|
|
|
|
|
has 'ShipToAddress' => ( |
|
113
|
|
|
|
|
|
|
is => 'ro', |
|
114
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Address]', |
|
115
|
|
|
|
|
|
|
traits => ['Printable'], |
|
116
|
|
|
|
|
|
|
documentation => 'Destination address', |
|
117
|
|
|
|
|
|
|
lazy_build => 1, |
|
118
|
|
|
|
|
|
|
); |
|
119
|
|
|
|
|
|
|
has 'Service' => ( |
|
120
|
|
|
|
|
|
|
is => 'ro', |
|
121
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::Code]', |
|
122
|
|
|
|
|
|
|
traits => ['Printable'], |
|
123
|
|
|
|
|
|
|
documentation => 'Service', |
|
124
|
|
|
|
|
|
|
lazy_build => 1, |
|
125
|
|
|
|
|
|
|
); |
|
126
|
|
|
|
|
|
|
has 'ReferenceNumber' => ( |
|
127
|
|
|
|
|
|
|
is => 'ro', |
|
128
|
|
|
|
|
|
|
isa => 'Maybe[Business::UPS::Tracking::Element::ReferenceNumber]', |
|
129
|
|
|
|
|
|
|
traits => ['Printable'], |
|
130
|
|
|
|
|
|
|
documentation => 'Reference number', |
|
131
|
|
|
|
|
|
|
lazy_build => 1, |
|
132
|
|
|
|
|
|
|
); |
|
133
|
|
|
|
|
|
|
has 'ShipmentIdentificationNumber' => ( |
|
134
|
|
|
|
|
|
|
is => 'ro', |
|
135
|
|
|
|
|
|
|
isa => 'Str', |
|
136
|
|
|
|
|
|
|
traits => ['Printable'], |
|
137
|
|
|
|
|
|
|
documentation => 'Identification number', |
|
138
|
|
|
|
|
|
|
lazy_build => 1, |
|
139
|
|
|
|
|
|
|
); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub _build_ScheduledDelivery { |
|
142
|
|
|
|
|
|
|
my ($self) = @_; |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
my $datestr = $self->xml->findvalue('ScheduledDeliveryDate'); |
|
145
|
|
|
|
|
|
|
my $date = Business::UPS::Tracking::Utils::parse_date($datestr); |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
my $timestr = $self->xml->findvalue('ScheduledDeliveryTime'); |
|
148
|
|
|
|
|
|
|
$date = Business::UPS::Tracking::Utils::parse_time( $timestr, $date ); |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
return $date; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub _build_PickupDate { |
|
154
|
|
|
|
|
|
|
my ($self) = @_; |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
my $datestr = $self->xml->findvalue('PickupDate'); |
|
157
|
|
|
|
|
|
|
return Business::UPS::Tracking::Utils::parse_date($datestr); |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub _build_ShipperNumber { |
|
161
|
|
|
|
|
|
|
my ($self) = @_; |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
return $self->xml->findvalue('Shipper/ShipperNumber'); |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub _build_ShipperAddress { |
|
167
|
|
|
|
|
|
|
my ($self) = @_; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
return $self->build_address('Shipper/Address'); |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub _build_ShipmentWeight { |
|
173
|
|
|
|
|
|
|
my ($self) = @_; |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
return $self->build_weight('ShipmentWeight'); |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub _build_ShipToAddress { |
|
179
|
|
|
|
|
|
|
my ($self) = @_; |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
return $self->build_address('ShipTo/Address'); |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub _build_Service { |
|
185
|
|
|
|
|
|
|
my ($self) = @_; |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
return $self->build_code('Service'); |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub _build_ReferenceNumber { |
|
191
|
|
|
|
|
|
|
my ($self) = @_; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
return $self->build_referencenumber('ReferenceNumber'); |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub _build_ShipmentIdentificationNumber { |
|
197
|
|
|
|
|
|
|
my ($self) = @_; |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
return $self->xml->findvalue('ShipmentIdentificationNumber') |
|
200
|
|
|
|
|
|
|
|| undef; |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 METHODS |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 ShipmentType |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Returns the shipment type. Either 'Freight' or 'Small Package' |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub ShipmentType { |
|
212
|
|
|
|
|
|
|
Business::UPS::Tracking::X->throw("__PACKAGE__ is an abstract class"); |
|
213
|
|
|
|
|
|
|
return; |
|
214
|
|
|
|
|
|
|
} |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 meta |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Moose meta method |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
224
|
|
|
|
|
|
|
no Moose; |
|
225
|
|
|
|
|
|
|
1; |