UPS/Response/ShipmentAccept.pm

filter: Statementstmt 95.2% 40 / 42 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 85.2% 52 / 61 CC 5 SCAR 10.4
CC
5
Cov
88%
BUILDARGS
5.4
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« UPS/QVSubscription.pm ↑ Summary UPS/Response/QV/Origin.pm »
1 package Net::Async::Webservice::UPS::Response::ShipmentAccept;
2 5 $Net::Async::Webservice::UPS::Response::ShipmentAccept::VERSION = '1.1.4';
3 {
4 5 $Net::Async::Webservice::UPS::Response::ShipmentAccept::DIST = 'Net-Async-Webservice-UPS';
5 }
6 5 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Types::Standard qw(Str ArrayRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Net::Async::Webservice::UPS::Types qw(:types);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Net::Async::Webservice::UPS::Response::Utils ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use List::AllUtils 'pairwise';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 extends 'Net::Async::Webservice::UPS::Response::ShipmentBase';
14  
15 # ABSTRACT: UPS response to a ShipAccept request
16  
17  
18 5 has pickup_request_number => (
19 is => 'ro',
20 isa => Str,
21 required => 0,
22 );
23  
24  
25 5 has control_log => (
26 is => 'ro',
27 isa => Image,
28 required => 0,
29 );
30  
31  
32 5 has package_results => (
33 is => 'ro',
34 isa => ArrayRef[PackageResult],
35 required => 0,
36 );
37  
38 3 ▶sub BUILDARGS {
Subroutine BUILDARGS: called CC=5 SCAR=16.8
Pod undocumented
39 3 my ($class,$hashref) = @_;
40 0 ▶ if (@_>2) { shift; $hashref={@_} };
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 2) 0 3 3
41  
42 3 my $ret = $class->next::method($hashref);
43  
44 3 ▶ if ($hashref->{ShipmentResults}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hashref->{"ShipmentResults"}) 3 0 3
45 3 require Net::Async::Webservice::UPS::Response::PackageResult;
46  
47 3 my $results = $hashref->{ShipmentResults};
48 3 my $weight = $results->{BillingWeight};
49 3 my $charges = $results->{ShipmentCharges};
50  
51 $ret = {
52 %$ret,
53 unit => $weight->{UnitOfMeasurement}{Code},
54 billing_weight => $weight->{Weight},
55 currency => $charges->{TotalCharges}{CurrencyCode},
56 service_option_charges => $charges->{ServiceOptionsCharges}{MonetaryValue},
57 transportation_charges => $charges->{TransportationCharges}{MonetaryValue},
58 total_charges => $charges->{TotalCharges}{MonetaryValue},
59 shipment_identification_number => $results->{ShipmentIdentificationNumber},
60 pair_if( pickup_request_number => $results->{PickupRequestNumber} ),
61 img_if( control_log => $results->{ControlLogReceipt} ),
62 4 ▶ package_results => [ pairwise {
Subroutine __ANON__: called CC=1 SCAR=0.0
63 4 my ($pr,$pack) = ($a, $b);
64  
65 4 Net::Async::Webservice::UPS::Response::PackageResult->new({
66 %$pr,
67 package => $pack,
68 });
69 3 ▶ } @{$results->{PackageResults}//[]},@{$hashref->{packages}//[]} ],
Condition50%2/4
$results->{"PackageResults"} // []
l!l
30
$hashref->{"packages"} // []
l!l
30
MC/DC0%0/1
$results->{"PackageResults"} // []
$results->{"PackageResults"}
MC/DC0%0/1
$hashref->{"packages"} // []
$hashref->{"packages"}
Truth table50%1/2
A
A= $results->{"PackageResults"}
Aresult
11
00
Truth table50%1/2
A
A= $hashref->{"packages"}
Aresult
11
00
70 };
71 }
72  
73 3 return $ret;
74 }
75  
76 5 1;
77  
78 __END__
« UPS/QVSubscription.pm ↑ Summary UPS/Response/QV/Origin.pm »