| 1 | package Net::Async::Webservice::UPS::Service; | ||||||||||||||||||||||||||||||||
| 2 | 5 | $Net::Async::Webservice::UPS::Service::VERSION = '1.1.4'; | |||||||||||||||||||||||||||||||
| 3 | { | ||||||||||||||||||||||||||||||||
| 4 | 5 | $Net::Async::Webservice::UPS::Service::DIST = 'Net-Async-Webservice-UPS'; | |||||||||||||||||||||||||||||||
| 5 | } | ||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Types::Standard qw(Str); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Net::Async::Webservice::UPS::Types ':types'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | # ABSTRACT: shipment service from UPS | ||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 5 | has code => ( | |||||||||||||||||||||||||||||||
| 16 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 17 | isa => ServiceCode, | ||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | 5 | has label => ( | |||||||||||||||||||||||||||||||
| 22 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 23 | isa => ServiceLabel, | ||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | 5 | has total_charges => ( | |||||||||||||||||||||||||||||||
| 28 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 29 | isa => Measure, | ||||||||||||||||||||||||||||||||
| 30 | required => 0, | ||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 5 | has rates => ( | |||||||||||||||||||||||||||||||
| 35 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 36 | isa => RateList, | ||||||||||||||||||||||||||||||||
| 37 | required => 0, | ||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 5 | has rated_packages => ( | |||||||||||||||||||||||||||||||
| 42 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 43 | isa => PackageList, | ||||||||||||||||||||||||||||||||
| 44 | required => 0, | ||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | 5 | has guaranteed_days => ( | |||||||||||||||||||||||||||||||
| 49 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 50 | isa => Str, | ||||||||||||||||||||||||||||||||
| 51 | required => 0, | ||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 5 | my %code_for_label = ( | |||||||||||||||||||||||||||||||
| 55 | NEXT_DAY_AIR => '01', | ||||||||||||||||||||||||||||||||
| 56 | '2ND_DAY_AIR' => '02', | ||||||||||||||||||||||||||||||||
| 57 | GROUND => '03', | ||||||||||||||||||||||||||||||||
| 58 | WORLDWIDE_EXPRESS => '07', | ||||||||||||||||||||||||||||||||
| 59 | WORLDWIDE_EXPEDITED => '08', | ||||||||||||||||||||||||||||||||
| 60 | STANDARD => '11', | ||||||||||||||||||||||||||||||||
| 61 | '3_DAY_SELECT' => '12', | ||||||||||||||||||||||||||||||||
| 62 | '3DAY_SELECT' => '12', | ||||||||||||||||||||||||||||||||
| 63 | NEXT_DAY_AIR_SAVER => '13', | ||||||||||||||||||||||||||||||||
| 64 | NEXT_DAY_AIR_EARLY_AM => '14', | ||||||||||||||||||||||||||||||||
| 65 | WORLDWIDE_EXPRESS_PLUS => '54', | ||||||||||||||||||||||||||||||||
| 66 | '2ND_DAY_AIR_AM' => '59', | ||||||||||||||||||||||||||||||||
| 67 | SAVER => '65', | ||||||||||||||||||||||||||||||||
| 68 | TODAY_EXPRESS_SAVER => '86', | ||||||||||||||||||||||||||||||||
| 69 | TODAY_EXPRESS => '85', | ||||||||||||||||||||||||||||||||
| 70 | TODAY_DEDICATED_COURIER => '83', | ||||||||||||||||||||||||||||||||
| 71 | TODAY_STANDARD => '82', | ||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||
| 73 | 5 | my %label_for_code = reverse %code_for_label; | |||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 17 | ▶ | sub label_for_code { | ||||||||||||||||||||||||||||||
|
Subroutine
label_for_code: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 77 | 17 | my ($code) = @_; | |||||||||||||||||||||||||||||||
| 78 | 17 | return $label_for_code{$code}; | |||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 25 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=24.7
| |||||||||||||||||||||||||||||||||
| 82 | 25 | my ($orig,$class,@etc) = @_; | |||||||||||||||||||||||||||||||
| 83 | 25 | my $args = $class->$orig(@etc); | |||||||||||||||||||||||||||||||
| 84 | 25 | ▶ | if ($args->{code} and not $args->{label}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$args->{"code"} and not $args->{"label"}
MC/DC0%0/2
$args->{"code"} and not $args->{"label"}
$args->{"code"}
not $args->{"label"}
Truth table66%2/3
A and not(B)
A= $args->{"code"}B= not $args->{"label"}
| |||||||||||||||||||||||||||||||||
| 85 | 0 | $args->{label} = $label_for_code{$args->{code}}; | |||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if (!defined $args->{label}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 87 | 0 | require Carp; | |||||||||||||||||||||||||||||||
| 88 | 0 | Carp::croak "Bad service code $args->{code}"; | |||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | ▶ | elsif ($args->{label} and not $args->{code}) { | |||||||||||||||||||||||||||||||
|
Condition66%2/3
$args->{"label"} and not $args->{"code"}
MC/DC50%1/2
$args->{"label"} and not $args->{"code"}
$args->{"label"}
not $args->{"code"}
Truth table66%2/3
A and not(B)
A= $args->{"label"}B= not $args->{"code"}
| |||||||||||||||||||||||||||||||||
| 92 | 8 | $args->{code} = $code_for_label{$args->{label}}; | |||||||||||||||||||||||||||||||
| 93 | 8 | ▶ | if (!defined $args->{code}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 94 | 0 | require Carp; | |||||||||||||||||||||||||||||||
| 95 | 0 | Carp::croak "Bad service label $args->{label}"; | |||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||
| 98 | 25 | return $args; | |||||||||||||||||||||||||||||||
| 99 | 5 | }; | |||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub name { | ||||||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 103 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||
| 105 | 0 | my $name = $self->label(); | |||||||||||||||||||||||||||||||
| 106 | 0 | $name =~ s/_/ /g; | |||||||||||||||||||||||||||||||
| 107 | 0 | return $name; | |||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub cache_id { return $_[0]->code } | ||||||||||||||||||||||||||||||
|
Subroutine
cache_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 5 | 1; | |||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | __END__ | ||||||||||||||||||||||||||||||||