UPS/Response/QV/Delivery.pm

filter: Statementstmt 94.7% 54 / 57 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 1 totaltotal 90.6% 68 / 75 CC 4 SCAR 7.4
CC
4
Cov
90%
BUILDARGS
4.8
__ANON__
1.0
BEGIN
1.0
CRAP 2.1
« UPS/Response/QV/Generic.pm ↑ Summary UPS/Response/Utils.pm »
1 package Net::Async::Webservice::UPS::Response::QV::Delivery;
2 1 $Net::Async::Webservice::UPS::Response::QV::Delivery::VERSION = '1.1.4';
3 {
4 1 $Net::Async::Webservice::UPS::Response::QV::Delivery::DIST = 'Net-Async-Webservice-UPS';
5 }
6 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Types::Standard qw(Str ArrayRef HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Net::Async::Webservice::UPS::Types qw(:types);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Net::Async::Webservice::UPS::Response::Utils qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Types::DateTime DateTime => { -as => 'DateTimeT' };
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use List::AllUtils 'any';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # ABSTRACT: a Quantum View "delivery" event
17  
18  
19 1 has package_reference => (
20 is => 'ro',
21 isa => ArrayRef[QVReference],
22 );
23  
24  
25 1 has shipment_reference => (
26 is => 'ro',
27 isa => ArrayRef[QVReference],
28 );
29  
30  
31 1 has shipper_number => (
32 is => 'ro',
33 isa => Str,
34 );
35  
36  
37 1 has tracking_number => (
38 is => 'ro',
39 isa => Str,
40 );
41  
42  
43 1 has date_time => (
44 is => 'ro',
45 isa => DateTimeT,
46 );
47  
48  
49 1 has activity_location => (
50 is => 'ro',
51 isa => Address,
52 );
53  
54  
55 1 has delivery_location => (
56 is => 'ro',
57 isa => Address,
58 );
59  
60  
61 1 has delivery_location_code => (
62 is => 'ro',
63 isa => Str,
64 );
65  
66  
67 1 has delivery_location_descripton => (
68 is => 'ro',
69 isa => Str,
70 );
71  
72  
73 1 has signed_for_by => (
74 is => 'ro',
75 isa => Str,
76 );
77  
78  
79 1 has driver_release => (
80 is => 'ro',
81 isa => Str,
82 );
83  
84  
85 1 has cod_currency => (
86 is => 'ro',
87 isa => Str,
88 required => 0,
89 );
90  
91  
92 1 has cod_value => (
93 is => 'ro',
94 isa => Measure,
95 required => 0,
96 );
97  
98  
99 1 has bill_to_account_number => (
100 is => 'ro',
101 isa => Str,
102 );
103  
104  
105 1 has bill_to_account_option => (
106 is => 'ro',
107 isa => Str,
108 );
109  
110  
111 1 has access_point_location_id => (
112 is => 'ro',
113 isa => Str,
114 );
115  
116  
117 1 has last_pickup => (
118 is => 'ro',
119 isa => Str,
120 );
121  
122 126 ▶sub BUILDARGS {
Subroutine BUILDARGS: called CC=4 SCAR=15.8
Pod undocumented
123 126 my ($class,$hashref) = @_;
124 0 ▶ if (@_>2) { shift; $hashref={@_} };
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 2) 0 126 126
125  
126 126 ▶ if (any { /^[A-Z]/ } keys %$hashref) {
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { /^[A-Z]/; } , keys %$hashref)) 126 0 126
127 126 state $date_parser = DateTime::Format::Strptime->new(
128 pattern => '%Y%m%d%H%M%S',
129 );
130 126 set_implied_argument($hashref);
131  
132 return {
133 in_if(tracking_number=>'TrackingNumber'),
134 in_if(shipper_number=>'ShipperNumber'),
135 in_object_array_if(shipment_reference => 'ShipmentReferenceNumber', 'Net::Async::Webservice::UPS::Response::QV::Reference'),
136 in_object_array_if(package_reference => 'PackageReferenceNumber', 'Net::Async::Webservice::UPS::Response::QV::Reference'),
137 ( $hashref->{Date} ? ( date_time => $date_parser->parse_datetime($hashref->{Date}.$hashref->{Time}) ) : () ),
138 in_object_if(activity_location => 'ActivityLocation', 'Net::Async::Webservice::UPS::Address'),
139 in_object_if(delivery_location => 'DeliveryLocation', 'Net::Async::Webservice::UPS::Address'),
140 pair_if(delivery_location_code => $hashref->{DeliveryLocation}{Code}),
141 pair_if(delivery_location_descripton => $hashref->{DeliveryLocation}{Description}),
142 pair_if(signed_for_by => $hashref->{DeliveryLocation}{SignedForByName}),
143 in_if(driver_release => 'DriverRelease'),
144 pair_if(cod_currency => $hashref->{COD}{CODAmount}{CurrencyCode}),
145 pair_if(cod_value => $hashref->{COD}{CODAmount}{MonetaryValue}),
146 pair_if(bill_to_account_number => $hashref->{BillToAccount}{Number}),
147 126 ▶ pair_if(bill_to_account_option => $hashref->{BillToAccount}{Option}),
Branch: 1 branch
BranchTrueFalseTotal
$hashref->{'Date'} ? : 126 0 126
148 in_if(access_point_location_id => 'AccessPointLocationID'),
149 in_if(last_pickup => 'LastPickupDate'),
150 };
151 }
152 0 return $hashref;
153 }
154  
155 1 1;
156  
157 __END__
« UPS/Response/QV/Generic.pm ↑ Summary UPS/Response/Utils.pm »