Twilio/Rest/Messaging/V1/Service/PhoneNumber.pm

filter: Statementstmt 85.2% 75 / 88 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 30 / 36 Podpod n/a totaltotal 81.8% 108 / 132 CC 3 SCAR 2.3
CC
3
Cov
84%
page
2.0
new
2.0
read
2.0
CRAP 1.3
« Twilio/Rest/Messaging/V1/Service/ChannelSender.pm ↑ Summary Twilio/Rest/Messaging/V1/Service/ShortCode.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Messaging::V1::Service::PhoneNumber;
3  
4 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Messaging::V1::Service::PhoneNumberList;
10  
11 2 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 5 my ($class, $version, $service_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { service_sid => $service_sid };
19 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/PhoneNumbers';
21 5 return $self;
22 }
23  
24 2 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
25 2 my ($self, $phone_number_sid) = @_;
26  
27 2 my $data = { PhoneNumberSid => $phone_number_sid, };
28  
29 my $response =
30 2 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
31 return Twilio::Rest::Messaging::V1::Service::PhoneNumberInstance->new($self->{version},
32 2 $response->get_content, $self->{solution}{service_sid});
33 }
34  
35 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
36 0 my ($self, @arguments) = @_;
37 0 return $self->read_records(@arguments);
38 }
39  
40 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
41 0 my ($self, @arguments) = @_;
42 0 return $self->stream_records(@arguments);
43 }
44  
45 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
46 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
47 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
01
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
48  
49 1 my $params = {
50 PageToken => $page_token,
51 Page => $page_number,
52 PageSize => $page_size,
53 };
54  
55 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
56 1 return $self->_build_page($response);
57 }
58  
59 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
60 0 my ($self, $target_url) = @_;
61 0 my $client = $self->{version}->get_domain->get_client;
62 0 return $self->_build_page($client->request('GET', $target_url));
63 }
64  
65 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
66 1 my ($self, $response) = @_;
67 return Twilio::Rest::Messaging::V1::Service::PhoneNumberPage->new($self->{version}, $response,
68 1 $self->{solution});
69 }
70  
71 2 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
72 2 my ($self, $sid) = @_;
73 return Twilio::Rest::Messaging::V1::Service::PhoneNumberContext->new($self->{version},
74 2 $self->{solution}{service_sid}, $sid);
75 }
76  
77 package Twilio::Rest::Messaging::V1::Service::PhoneNumberPage;
78  
79 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 1 ▶sub records_key { return 'phone_numbers' }
Subroutine records_key: called CC=1 SCAR=0.0
82  
83 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
84 1 my ($self, $payload) = @_;
85 return Twilio::Rest::Messaging::V1::Service::PhoneNumberInstance->new($self->{version}, $payload,
86 1 $self->{solution}{service_sid});
87 }
88  
89 package Twilio::Rest::Messaging::V1::Service::PhoneNumberContext;
90  
91 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
92  
93 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
96 2 my ($class, $version, $service_sid, $sid) = @_;
97 2 my $self = $class->SUPER::new($version);
98 2 $self->{solution} = { service_sid => $service_sid, sid => $sid };
99 2 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
100 '/PhoneNumbers/', Twilio::Serialize::path_segment($sid);
101 2 return $self;
102 }
103  
104 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
105 1 my ($self) = @_;
106 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
107 1 return 1;
108 }
109  
110 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
111 1 my ($self) = @_;
112  
113 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
114 1 return $self->_build_instance($response);
115 }
116  
117 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
118 1 my ($self, $response) = @_;
119 return Twilio::Rest::Messaging::V1::Service::PhoneNumberInstance->new(
120 $self->{version}, $response->get_content,
121 $self->{solution}{service_sid}, $self->{solution}{sid}
122 1 );
123 }
124  
125 package Twilio::Rest::Messaging::V1::Service::PhoneNumberInstance;
126  
127 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
128  
129 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
130  
131 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
132 4 my ($class, $version, $payload, $service_sid, $sid) = @_;
133 4 my $self = $class->SUPER::new($version, $payload);
134 4 ▶ $self->{solution} = { service_sid => $service_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
130
MC/DC0%0/2
$sid // $self->{"properties"}{"sid"}
$sid $self->{"properties"}{"sid"}
Truth table66%2/3
A // B
A= $sidB= $self->{"properties"}{"sid"}
ABresult
1X1
011
000
135 4 return $self;
136 }
137  
138 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
139 0 my ($self, @arguments) = @_;
140 0 return $self->_context->delete(@arguments);
141 }
142  
143 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
144 0 my ($self, @arguments) = @_;
145 0 return $self->_context->fetch(@arguments);
146 }
147  
148 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
149 0 my ($self) = @_;
150 return Twilio::Rest::Messaging::V1::Service::PhoneNumberContext->new(
151 $self->{version},
152 $self->{solution}{service_sid},
153 $self->{solution}{sid}
154 0 );
155 }
156  
157 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
158 4 ▶sub capabilities { return $_[0]{properties}{capabilities} }
Subroutine capabilities: called CC=1 SCAR=0.0
159 4 ▶sub country_code { return $_[0]{properties}{country_code} }
Subroutine country_code: called CC=1 SCAR=0.0
160 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
161 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
162 4 ▶sub phone_number { return $_[0]{properties}{phone_number} }
Subroutine phone_number: called CC=1 SCAR=0.0
163 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
164 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
165 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
166  
167 2 1;
168  
169 __END__
« Twilio/Rest/Messaging/V1/Service/ChannelSender.pm ↑ Summary Twilio/Rest/Messaging/V1/Service/ShortCode.pm »