| 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
| |||||||||||||||||||||||||||||||||||||||
| 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
Condition100%3/3
defined $content->{"more_info"} or defined $content->{"status"}
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"}
| |||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||
| 35 | 8 | ▶ | $message .= ": $content->{message}" if defined $content->{message}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 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
$content->{"httpStatusCode"} // $status
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
Truth table66%2/3
A // B
A= $content->{"httpStatusCode"}B= $status
| |||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||
| 43 | 7 | 1; | |||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||||||||||||