UPS/QVSubscription.pm

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 93.7% 45 / 48 CC 5 SCAR 10.8
CC
5
Cov
92%
as_hash
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« UPS/Response/Rate.pm ↑ Summary UPS/Response/ShipmentAccept.pm »
1 package Net::Async::Webservice::UPS::QVSubscription;
2 5 $Net::Async::Webservice::UPS::QVSubscription::VERSION = '1.1.4';
3 {
4 5 $Net::Async::Webservice::UPS::QVSubscription::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 Int Bool StrictNum);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 use Types::DateTime
10 5 ▶ DateTime => { -as => 'DateTimeT' },
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 Format => { -as => 'DTFormat' };
12 5 ▶use Net::Async::Webservice::UPS::Types ':types';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 5 my $dt = DateTimeT->plus_coercions(DTFormat['ISO8601']);
16  
17 # ABSTRACT: a UPS Quantum View subscription
18  
19  
20 5 has begin_date => (
21 is => 'ro',
22 isa => $dt,
23 coerce => $dt->coercion
24 );
25  
26  
27 5 has end_date => (
28 is => 'ro',
29 isa => $dt,
30 coerce => $dt->coercion
31 );
32  
33  
34 5 has name => (
35 is => 'ro',
36 isa => Str,
37 );
38  
39  
40 5 has filename => (
41 is => 'ro',
42 isa => Str,
43 );
44  
45  
46 2 ▶sub as_hash {
Subroutine as_hash: called CC=5 SCAR=16.6
Pod documented
47 2 my ($self) = @_;
48  
49 2 ▶ my $sr = {
Branch: 2 branches
BranchTrueFalseTotal
$self->name ? : 0 2 2
$self->filename ? : 0 2 2
50 ( $self->name ? ( Name => $self->name ) : () ),
51 ( $self->filename ? ( FileName => $self->filename ) : () ),
52 };
53  
54 2 for my $f (qw(begin end)){
55 4 my $method = "${f}_date";
56 4 ▶ if ($self->$method) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->$method) 4 0 4
57 4 my $date = $self->$method->clone->set_time_zone('UTC');
58 4 $sr->{DateTimeRange}{"\u${f}DateTime"} =
59 $date->strftime('%Y%m%d%H%M%S');
60 }
61 }
62  
63 2 return $sr;
64 }
65  
66 5 1;
67  
68 __END__
« UPS/Response/Rate.pm ↑ Summary UPS/Response/ShipmentAccept.pm »