Twilio/Rest/Routes/V3/PhoneNumber.pm

filter: Statementstmt 96.9% 63 / 65 Branchbran n/a Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 96.1% 25 / 26 Podpod n/a totaltotal 90.9% 90 / 99 CC 3 SCAR 1.7
CC
3
Cov
93%
new
2.1
update
2.0
update
2.0
CRAP 1.2
« Twilio/Rest/FlexApi/V1/PluginArchive.pm ↑ Summary Twilio/Rest/Lookups/V2/RateLimit.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Routes::V3::PhoneNumber;
3  
4 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Routes::V3::PhoneNumberList;
10  
11 3 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 4 my ($class, $version) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = {};
19 4 $self->{uri} = '/PhoneNumbers';
20 4 return $self;
21 }
22  
23 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
24 4 my ($self, $phone_number) = @_;
25 4 return Twilio::Rest::Routes::V3::PhoneNumberContext->new($self->{version}, $phone_number);
26 }
27  
28 package Twilio::Rest::Routes::V3::PhoneNumberContext;
29  
30 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
35 5 my ($class, $version, $phone_number) = @_;
36 5 my $self = $class->SUPER::new($version);
37 5 $self->{solution} = { phone_number => $phone_number };
38 5 $self->{uri} = join q{}, '/PhoneNumbers/', Twilio::Serialize::path_segment($phone_number);
39 5 return $self;
40 }
41  
42 4 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
43 4 my ($self) = @_;
44  
45 4 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
46 3 return $self->_build_instance($response);
47 }
48  
49 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
50 1 my ($self, $options) = @_;
51 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
52  
53 my $data = {
54 friendlyName => $options->{friendly_name},
55 messagingRegion => $options->{messaging_region},
56 voiceRegion => $options->{voice_region},
57 1 };
58  
59 my $response =
60 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
61 1 return $self->_build_instance($response);
62 }
63  
64 4 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
65 4 my ($self, $response) = @_;
66 return Twilio::Rest::Routes::V3::PhoneNumberInstance->new($self->{version},
67 4 $response->get_content, $self->{solution}{phone_number});
68 }
69  
70 package Twilio::Rest::Routes::V3::PhoneNumberInstance;
71  
72 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
75  
76 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.4
77 4 my ($class, $version, $payload, $phone_number) = @_;
78 4 my $self = $class->SUPER::new($version, $payload);
79 4 ▶ $self->{solution} = { phone_number => $phone_number // $self->{properties}{phoneNumber} };
Condition33%1/3
$phone_number // $self->{"properties"}{"phoneNumber"}
l!l&&r!l&&!r
400
MC/DC0%0/2
$phone_number // $self->{"properties"}{"phoneNumber"}
$phone_number $self->{"properties"}{"phoneNumber"}
Truth table33%1/3
A // B
A= $phone_numberB= $self->{"properties"}{"phoneNumber"}
ABresult
1X1
011
000
80 4 return $self;
81 }
82  
83 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
84 1 my ($self, @arguments) = @_;
85 1 return $self->_context->fetch(@arguments);
86 }
87  
88 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
89 0 my ($self, @arguments) = @_;
90 0 return $self->_context->update(@arguments);
91 }
92  
93 1 ▶sub _context {
Subroutine _context: called CC=1 SCAR=0.0
94 1 my ($self) = @_;
95 return Twilio::Rest::Routes::V3::PhoneNumberContext->new($self->{version},
96 1 $self->{solution}{phone_number});
97 }
98  
99 2 ▶sub account_sid { return $_[0]{properties}{accountSid} }
Subroutine account_sid: called CC=1 SCAR=0.0
100 2 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{dateCreated}) }
Subroutine date_created: called CC=1 SCAR=0.0
101 2 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{dateUpdated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
102 3 ▶sub friendly_name { return $_[0]{properties}{friendlyName} }
Subroutine friendly_name: called CC=1 SCAR=0.0
103 2 ▶sub messaging_region { return $_[0]{properties}{messagingRegion} }
Subroutine messaging_region: called CC=1 SCAR=0.0
104 2 ▶sub phone_number { return $_[0]{properties}{phoneNumber} }
Subroutine phone_number: called CC=1 SCAR=0.0
105 2 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
106 2 ▶sub voice_region { return $_[0]{properties}{voiceRegion} }
Subroutine voice_region: called CC=1 SCAR=0.0
107  
108 3 1;
109  
110 __END__
« Twilio/Rest/FlexApi/V1/PluginArchive.pm ↑ Summary Twilio/Rest/Lookups/V2/RateLimit.pm »