SmartyStreets.pm

filter: Statementstmt 93.7% 60 / 64 Branchbran 53.1% 17 / 32 Conditioncond 33.3% 8 / 24 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 64.5% 93 / 144 CC 25 SCAR 37.9
CC
25
Cov
71%
verify_address
56.3
BEGIN
1.0
BEGIN
1.0
CRAP 44.2
↑ Summary SmartyStreets/Exception/AddressMissingInformation.pm »
1 package WebService::SmartyStreets;
2 3 $WebService::SmartyStreets::VERSION = '0.0105';
3 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 with 'WebService::Client';
5  
6 # VERSION
7  
8 3 ▶use aliased 'WebService::SmartyStreets::Exception::AddressNotFound';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use aliased 'WebService::SmartyStreets::Exception::AddressMissingInformation';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 has auth_id => ( is => 'ro', required => 1 );
15 3 has auth_token => ( is => 'ro', required => 1 );
16  
17 has '+base_url' => (
18 1 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
19 1 my $self = shift;
20 1 my $uri = URI->new('https://api.smartystreets.com/street-address');
21 1 $uri->query_form(
22 'auth-id' => $self->auth_id,
23 'auth-token' => $self->auth_token,
24 );
25 1 return $uri->as_string;
26 },
27 3 );
28  
29 3 ▶method verify_address(
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine verify_address: called CC=25 SCAR=40.3
30 6 ▶ Str :$street!,
Branch: 2 branches
BranchTrueFalseTotal
unless exists $args{"street"} 1 5 6
unless ($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($street) 0 5 5
Condition66%2/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
l!l&&r!l&&!r
410
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"} "Method::Signatures"->_make_constraint("Str")
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
ABresult
1X1
011
000
31 5 ▶ Str :$street2 = '',
Branch: 2 branches
BranchTrueFalseTotal
exists $args{'street2'} ? : 0 5 5
unless ($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($street2) 0 5 5
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
l!l&&r!l&&!r
500
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"} "Method::Signatures"->_make_constraint("Str")
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
ABresult
1X1
011
000
32 5 ▶ Str :$city!,
Branch: 2 branches
BranchTrueFalseTotal
unless exists $args{"city"} 1 4 5
unless ($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($city) 0 4 4
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
l!l&&r!l&&!r
400
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"} "Method::Signatures"->_make_constraint("Str")
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
ABresult
1X1
011
000
33 4 ▶ Str :$state!,
Branch: 2 branches
BranchTrueFalseTotal
unless exists $args{"state"} 1 3 4
unless ($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($state) 0 3 3
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
l!l&&r!l&&!r
300
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"} "Method::Signatures"->_make_constraint("Str")
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
ABresult
1X1
011
000
34 3 ▶ Str :$zipcode = '',
Branch: 2 branches
BranchTrueFalseTotal
exists $args{'zipcode'} ? : 3 0 3
unless ($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($zipcode) 0 3 3
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
l!l&&r!l&&!r
300
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"} "Method::Signatures"->_make_constraint("Str")
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
ABresult
1X1
011
000
35 3 ▶ Int :$candidates = 2
Branch: 4 branches
BranchTrueFalseTotal
exists $args{'candidates'} ? : 0 3 3
unless ($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($candidates) 0 3 3
if keys %args 0 3 3
if scalar @_ > 12 0 3 3
Condition66%2/3
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
l!l&&r!l&&!r
210
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
$Method::Signatures::mutc{"cache"}{"Int"} "Method::Signatures"->_make_constraint("Int")
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Int"}B= "Method::Signatures"->_make_constraint("Int")
ABresult
1X1
011
000
36 ) {
37 3 my $results = $self->post($self->base_url, [{
38 street => $street,
39 street2 => $street2,
40 city => $city,
41 state => $state,
42 zipcode => $zipcode,
43 candidates => $candidates,
44 }]);
45  
46 0 ▶ AddressNotFound->throw unless $results and @$results;
Branch: 1 branch
BranchTrueFalseTotal
unless $results and @$results 0 0 0
Condition0%0/3
$results and @$results
!ll&&!rl&&r
000
MC/DC0%0/2
$results and @$results
$results @$results
Truth table0%0/3
A and B
A= $resultsB= @$results
ABresult
0X0
100
111
47 AddressMissingInformation->throw if @$results == 1
48 0 ▶ and $results->[0]{analysis}{dpv_match_code} eq 'D';
Branch: 1 branch
BranchTrueFalseTotal
if @$results == 1 and $results->[0]{"analysis"}{"dpv_match_code"} eq "D" 0 0 0
Condition0%0/3
@$results == 1 and $results->[0]{"analysis"}{"dpv_match_code"} eq "D"
!ll&&!rl&&r
000
MC/DC0%0/2
@$results == 1 and $results->[0]{"analysis"}{"dpv_match_code"} eq "D"
@$results == 1 $results->[0]{"analysis"}{"dpv_match_code"} eq "D"
Truth table0%0/3
A and B
A= @$results == 1B= $results->[0]{"analysis"}{"dpv_match_code"} eq "D"
ABresult
0X0
100
111
49  
50 return [
51 0 map {{
52 street => $_->{delivery_line_1},
53 (street2 => $_->{delivery_line_2}) x!! $_->{delivery_line_2},
54 city => $_->{components}{city_name},
55 state => $_->{components}{state_abbreviation},
56 zipcode => $_->{components}{zipcode} . '-' . $_->{components}{plus4_code},
57 0 }} @$results
58 ];
59 }
60  
61  
62 3 1;
63  
64 __END__
↑ Summary SmartyStreets/Exception/AddressMissingInformation.pm »