Twilio/ApiV1Version.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 6 / 6 Conditioncond 77.7% 7 / 9 MC/DCmcdc 33.3% 2 / 6 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 89.8% 53 / 59 CC 7 SCAR 14.5
CC
7
Cov
95%
exception
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.2
« Twilio/Http/ValidationClient.pm ↑ Summary Twilio/Jwt/TaskRouter/Policy.pm »
1 package Twilio::ApiV1Version;
2  
3 7 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 ▶use parent 'Twilio::Version';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use Twilio::Exceptions::RestException;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use Twilio::Exceptions::RestExceptionV1;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 our $VERSION = '2.001';
12  
13 186 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
14 186 my ($class, $domain, $version) = @_;
15 186 my $self = $class->SUPER::new($domain);
16 186 $self->{version} = $version;
17 186 return $self;
18 }
19  
20 15 ▶sub exception {
Subroutine exception: called CC=7 SCAR=19.5
Pod documented
21 15 my ($self, $response, $header) = @_;
22  
23 15 my $status = $response->get_status_code;
24 15 my $message = "[HTTP $status] $header";
25 15 my $content = $response->get_content;
26 15 ▶ if (ref $content ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $content ne "HASH") 1 14 15
27 1 return Twilio::Exceptions::RestExceptionV1->new($status, $message, $status);
28 }
29  
30 # Older services behind these APIs still answer in the classic shape, and newer ones in the RFC
31 # 9457 shape, which has a status too; the parent class tells those two apart.
32 return $self->SUPER::exception($response, $header)
33 14 ▶ if defined $content->{more_info} || defined $content->{status};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content->{"more_info"} or defined $content->{"status"} 6 8 14
Condition100%3/3
defined $content->{"more_info"} or defined $content->{"status"}
l!l&&r!l&&!r
338
MC/DC100%2/2
defined $content->{"more_info"} or defined $content->{"status"}
defined $content->{"more_info"} defined $content->{"status"}
Truth table100%3/3
A or B
A= defined $content->{"more_info"}B= defined $content->{"status"}
ABresult
1X1
011
000
34  
35 8 ▶ $message .= ": $content->{message}" if defined $content->{message};
Branch: 1 branch
BranchTrueFalseTotal
if defined $content->{"message"} 4 4 8
36 return Twilio::Exceptions::RestExceptionV1->new(
37 $content->{code} // $status,
38 $message, $content->{httpStatusCode} // $status,
39 $content->{params}, $content->{userError},
40 8 ▶ );
Condition66%4/6
$content->{"code"} // $status
l!l&&r!l&&!r
530
$content->{"httpStatusCode"} // $status
l!l&&r!l&&!r
350
MC/DC0%0/2
$content->{"code"} // $status
$content->{"code"} $status
MC/DC0%0/2
$content->{"httpStatusCode"} // $status
$content->{"httpStatusCode"} $status
Truth table66%2/3
A // B
A= $content->{"code"}B= $status
ABresult
1X1
011
000
Truth table66%2/3
A // B
A= $content->{"httpStatusCode"}B= $status
ABresult
1X1
011
000
41 }
42  
43 7 1;
44  
45 __END__
« Twilio/Http/ValidationClient.pm ↑ Summary Twilio/Jwt/TaskRouter/Policy.pm »