Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber.pm

filter: Statementstmt 87.5% 120 / 137 Branchbran 100% 2 / 2 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 88.4% 61 / 69 Podpod n/a totaltotal 84.6% 188 / 222 CC 6 SCAR 2.2
CC
6
Cov
86%
create
2.0
page
2.0
update
2.0
CRAP 1.2
« Twilio/Rest/Bulkexports/V1/ExportConfiguration.pm ↑ Summary Twilio/Rest/Marketplace/V1/ModuleDataManagement.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber;
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::Api::V2010::Account::IncomingPhoneNumberList;
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 19 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 19 my ($class, $version, $account_sid) = @_;
17 19 my $self = $class->SUPER::new($version);
18 19 $self->{solution} = { account_sid => $account_sid };
19 19 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
20 '/IncomingPhoneNumbers.json';
21 19 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $options) = @_;
26 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
27  
28 my $data = {
29 AddressSid => $options->{address_sid},
30 ApiVersion => $options->{api_version},
31 AreaCode => $options->{area_code},
32 BundleSid => $options->{bundle_sid},
33 EmergencyAddressSid => $options->{emergency_address_sid},
34 EmergencyStatus => $options->{emergency_status},
35 FriendlyName => $options->{friendly_name},
36 IdentitySid => $options->{identity_sid},
37 PhoneNumber => $options->{phone_number},
38 SmsApplicationSid => $options->{sms_application_sid},
39 SmsFallbackMethod => $options->{sms_fallback_method},
40 SmsFallbackUrl => $options->{sms_fallback_url},
41 SmsMethod => $options->{sms_method},
42 SmsUrl => $options->{sms_url},
43 StatusCallback => $options->{status_callback},
44 StatusCallbackMethod => $options->{status_callback_method},
45 TrunkSid => $options->{trunk_sid},
46 VoiceApplicationSid => $options->{voice_application_sid},
47 VoiceCallerIdLookup => Twilio::Serialize::boolean_to_string($options->{voice_caller_id_lookup}),
48 VoiceFallbackMethod => $options->{voice_fallback_method},
49 VoiceFallbackUrl => $options->{voice_fallback_url},
50 VoiceMethod => $options->{voice_method},
51 VoiceReceiveMode => $options->{voice_receive_mode},
52 VoiceUrl => $options->{voice_url},
53 1 };
54  
55 my $response =
56 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
57 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberInstance->new($self->{version},
58 1 $response->get_content, $self->{solution}{account_sid});
59 }
60  
61 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
62 0 my ($self, @arguments) = @_;
63 0 return $self->read_records(@arguments);
64 }
65  
66 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
67 0 my ($self, @arguments) = @_;
68 0 return $self->stream_records(@arguments);
69 }
70  
71 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
72 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
73 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
74  
75 my $params = {
76 Beta => Twilio::Serialize::boolean_to_string($options->{beta}),
77 FriendlyName => $options->{friendly_name},
78 Origin => $options->{origin},
79 PhoneNumber => $options->{phone_number},
80 1 PageToken => $page_token,
81 Page => $page_number,
82 PageSize => $page_size,
83 };
84  
85 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
86 1 return $self->_build_page($response);
87 }
88  
89 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
90 0 my ($self, $target_url) = @_;
91 0 my $client = $self->{version}->get_domain->get_client;
92 0 return $self->_build_page($client->request('GET', $target_url));
93 }
94  
95 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
96 1 my ($self, $response) = @_;
97 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberPage->new($self->{version},
98 1 $response, $self->{solution});
99 }
100  
101 10 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
102 10 my ($self, $sid) = @_;
103 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberContext->new($self->{version},
104 10 $self->{solution}{account_sid}, $sid);
105 }
106  
107 3 ▶sub local {
Subroutine local: called CC=1 SCAR=0.0
108 3 my ($self) = @_;
109 3 require Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::Local;
110 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::LocalList->new($self->{version},
111 3 $self->{solution}{account_sid});
112 }
113  
114 2 ▶sub mobile {
Subroutine mobile: called CC=1 SCAR=0.0
115 2 my ($self) = @_;
116 2 require Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::Mobile;
117 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::MobileList->new($self->{version},
118 2 $self->{solution}{account_sid});
119 }
120  
121 2 ▶sub toll_free {
Subroutine toll_free: called CC=1 SCAR=0.0
122 2 my ($self) = @_;
123 2 require Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::TollFree;
124 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::TollFreeList->new($self->{version},
125 2 $self->{solution}{account_sid});
126 }
127  
128 package Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberPage;
129  
130 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
131  
132 1 ▶sub records_key { return 'incoming_phone_numbers' }
Subroutine records_key: called CC=1 SCAR=0.0
133  
134 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
135 1 my ($self, $payload) = @_;
136 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberInstance->new($self->{version},
137 1 $payload, $self->{solution}{account_sid});
138 }
139  
140 package Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberContext;
141  
142 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
143  
144 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 10 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
147 10 my ($class, $version, $account_sid, $sid) = @_;
148 10 my $self = $class->SUPER::new($version);
149 10 $self->{solution} = { account_sid => $account_sid, sid => $sid };
150 10 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
151 '/IncomingPhoneNumbers/', Twilio::Serialize::path_segment($sid), '.json';
152 10 return $self;
153 }
154  
155 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
156 1 my ($self) = @_;
157 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
158 1 return 1;
159 }
160  
161 2 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
162 2 my ($self) = @_;
163  
164 2 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
165 2 return $self->_build_instance($response);
166 }
167  
168 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
169 1 my ($self, $options) = @_;
170 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
171  
172 my $data = {
173 AccountSid => $options->{account_sid},
174 AddressSid => $options->{address_sid},
175 ApiVersion => $options->{api_version},
176 BundleSid => $options->{bundle_sid},
177 EmergencyAddressSid => $options->{emergency_address_sid},
178 EmergencyStatus => $options->{emergency_status},
179 FriendlyName => $options->{friendly_name},
180 IdentitySid => $options->{identity_sid},
181 SmsApplicationSid => $options->{sms_application_sid},
182 SmsFallbackMethod => $options->{sms_fallback_method},
183 SmsFallbackUrl => $options->{sms_fallback_url},
184 SmsMethod => $options->{sms_method},
185 SmsUrl => $options->{sms_url},
186 StatusCallback => $options->{status_callback},
187 StatusCallbackMethod => $options->{status_callback_method},
188 TrunkSid => $options->{trunk_sid},
189 VoiceApplicationSid => $options->{voice_application_sid},
190 VoiceCallerIdLookup => Twilio::Serialize::boolean_to_string($options->{voice_caller_id_lookup}),
191 VoiceFallbackMethod => $options->{voice_fallback_method},
192 VoiceFallbackUrl => $options->{voice_fallback_url},
193 VoiceMethod => $options->{voice_method},
194 VoiceReceiveMode => $options->{voice_receive_mode},
195 VoiceUrl => $options->{voice_url},
196 1 };
197  
198 my $response =
199 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
200 1 return $self->_build_instance($response);
201 }
202  
203 3 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
204 3 my ($self, $response) = @_;
205 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberInstance->new(
206 $self->{version}, $response->get_content,
207 $self->{solution}{account_sid}, $self->{solution}{sid}
208 3 );
209 }
210  
211 6 ▶sub assigned_add_ons {
Subroutine assigned_add_ons: called CC=2 SCAR=6.9
212 6 my ($self, $sid) = @_;
213 6 require Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::AssignedAddOn;
214 my $list = Twilio::Rest::Api::V2010::Account::IncomingPhoneNumber::AssignedAddOnList->new(
215 $self->{version},
216 $self->{solution}{account_sid},
217 $self->{solution}{sid}
218 6 );
219 6 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 4 2 6
220 }
221  
222 package Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberInstance;
223  
224 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
225  
226 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
227  
228 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
229 5 my ($class, $version, $payload, $account_sid, $sid) = @_;
230 5 my $self = $class->SUPER::new($version, $payload);
231 5 ▶ $self->{solution} = { account_sid => $account_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
320
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
232 5 return $self;
233 }
234  
235 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
236 0 my ($self, @arguments) = @_;
237 0 return $self->_context->delete(@arguments);
238 }
239  
240 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
241 0 my ($self, @arguments) = @_;
242 0 return $self->_context->fetch(@arguments);
243 }
244  
245 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
246 0 my ($self, @arguments) = @_;
247 0 return $self->_context->update(@arguments);
248 }
249  
250 0 ▶sub assigned_add_ons {
Subroutine assigned_add_ons: not called CC=1 SCAR=6.9
251 0 my ($self, @arguments) = @_;
252 0 return $self->_context->assigned_add_ons(@arguments);
253 }
254  
255 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
256 0 my ($self) = @_;
257 return Twilio::Rest::Api::V2010::Account::IncomingPhoneNumberContext->new(
258 $self->{version},
259 $self->{solution}{account_sid},
260 $self->{solution}{sid}
261 0 );
262 }
263  
264 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
265 4 ▶sub address_requirements { return $_[0]{properties}{address_requirements} }
Subroutine address_requirements: called CC=1 SCAR=0.0
266 4 ▶sub address_sid { return $_[0]{properties}{address_sid} }
Subroutine address_sid: called CC=1 SCAR=0.0
267 4 ▶sub api_version { return $_[0]{properties}{api_version} }
Subroutine api_version: called CC=1 SCAR=0.0
268 4 ▶sub beta { return $_[0]{properties}{beta} }
Subroutine beta: called CC=1 SCAR=0.0
269 4 ▶sub bundle_sid { return $_[0]{properties}{bundle_sid} }
Subroutine bundle_sid: called CC=1 SCAR=0.0
270  
271 5 ▶sub capabilities {
Subroutine capabilities: called CC=1 SCAR=0.0
272 5 return Twilio::Deserialize::phone_number_capabilities($_[0]{properties}{capabilities});
273 }
274 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
275 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
276 4 ▶sub emergency_address_sid { return $_[0]{properties}{emergency_address_sid} }
Subroutine emergency_address_sid: called CC=1 SCAR=0.0
277 4 ▶sub emergency_address_status { return $_[0]{properties}{emergency_address_status} }
Subroutine emergency_address_status: called CC=1 SCAR=0.0
278 4 ▶sub emergency_status { return $_[0]{properties}{emergency_status} }
Subroutine emergency_status: called CC=1 SCAR=0.0
279 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
280 4 ▶sub identity_sid { return $_[0]{properties}{identity_sid} }
Subroutine identity_sid: called CC=1 SCAR=0.0
281 4 ▶sub origin { return $_[0]{properties}{origin} }
Subroutine origin: called CC=1 SCAR=0.0
282 4 ▶sub phone_number { return $_[0]{properties}{phone_number} }
Subroutine phone_number: called CC=1 SCAR=0.0
283 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
284 4 ▶sub sms_application_sid { return $_[0]{properties}{sms_application_sid} }
Subroutine sms_application_sid: called CC=1 SCAR=0.0
285 4 ▶sub sms_fallback_method { return $_[0]{properties}{sms_fallback_method} }
Subroutine sms_fallback_method: called CC=1 SCAR=0.0
286 4 ▶sub sms_fallback_url { return $_[0]{properties}{sms_fallback_url} }
Subroutine sms_fallback_url: called CC=1 SCAR=0.0
287 4 ▶sub sms_method { return $_[0]{properties}{sms_method} }
Subroutine sms_method: called CC=1 SCAR=0.0
288 4 ▶sub sms_url { return $_[0]{properties}{sms_url} }
Subroutine sms_url: called CC=1 SCAR=0.0
289 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
290 4 ▶sub status_callback { return $_[0]{properties}{status_callback} }
Subroutine status_callback: called CC=1 SCAR=0.0
291 4 ▶sub status_callback_method { return $_[0]{properties}{status_callback_method} }
Subroutine status_callback_method: called CC=1 SCAR=0.0
292 4 ▶sub trunk_sid { return $_[0]{properties}{trunk_sid} }
Subroutine trunk_sid: called CC=1 SCAR=0.0
293 4 ▶sub type { return $_[0]{properties}{type} }
Subroutine type: called CC=1 SCAR=0.0
294 4 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
295 4 ▶sub voice_application_sid { return $_[0]{properties}{voice_application_sid} }
Subroutine voice_application_sid: called CC=1 SCAR=0.0
296 4 ▶sub voice_caller_id_lookup { return $_[0]{properties}{voice_caller_id_lookup} }
Subroutine voice_caller_id_lookup: called CC=1 SCAR=0.0
297 4 ▶sub voice_fallback_method { return $_[0]{properties}{voice_fallback_method} }
Subroutine voice_fallback_method: called CC=1 SCAR=0.0
298 4 ▶sub voice_fallback_url { return $_[0]{properties}{voice_fallback_url} }
Subroutine voice_fallback_url: called CC=1 SCAR=0.0
299 4 ▶sub voice_method { return $_[0]{properties}{voice_method} }
Subroutine voice_method: called CC=1 SCAR=0.0
300 4 ▶sub voice_receive_mode { return $_[0]{properties}{voice_receive_mode} }
Subroutine voice_receive_mode: called CC=1 SCAR=0.0
301 4 ▶sub voice_url { return $_[0]{properties}{voice_url} }
Subroutine voice_url: called CC=1 SCAR=0.0
302  
303 3 1;
304  
305 __END__
« Twilio/Rest/Bulkexports/V1/ExportConfiguration.pm ↑ Summary Twilio/Rest/Marketplace/V1/ModuleDataManagement.pm »