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

filter: Statementstmt 80.1% 133 / 166 Branchbran 100% 14 / 14 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 78.3% 58 / 74 Podpod n/a totaltotal 78.3% 210 / 268 CC 12 SCAR 3.7
CC
12
Cov
80%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/FlexApi/V1/InsightsQuestionnairesCategory.pm ↑ Summary Twilio/Rest/Messaging/V1/Service.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Api::V2010::Account::Call;
3  
4 4 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Api::V2010::Account::CallList;
10  
11 4 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 40 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 40 my ($class, $version, $account_sid) = @_;
17 40 my $self = $class->SUPER::new($version);
18 40 $self->{solution} = { account_sid => $account_sid };
19 40 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
20 '/Calls.json';
21 40 return $self;
22 }
23  
24 5 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 5 my ($self, $to, $from, $options) = @_;
26 5 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
50
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
27  
28 my $data = {
29 To => $to,
30 From => $from,
31 ApplicationSid => $options->{application_sid},
32 AsyncAmd => $options->{async_amd},
33 AsyncAmdStatusCallback => $options->{async_amd_status_callback},
34 AsyncAmdStatusCallbackMethod => $options->{async_amd_status_callback_method},
35 Byoc => $options->{byoc},
36 CallReason => $options->{call_reason},
37 CallToken => $options->{call_token},
38 CallerId => $options->{caller_id},
39 ClientNotificationUrl => $options->{client_notification_url},
40 FallbackMethod => $options->{fallback_method},
41 FallbackUrl => $options->{fallback_url},
42 MachineDetection => $options->{machine_detection},
43 MachineDetectionSilenceTimeout => $options->{machine_detection_silence_timeout},
44 MachineDetectionSpeechEndThreshold => $options->{machine_detection_speech_end_threshold},
45 MachineDetectionSpeechThreshold => $options->{machine_detection_speech_threshold},
46 MachineDetectionTimeout => $options->{machine_detection_timeout},
47 Method => $options->{method},
48 Passports => $options->{passports},
49 Record => Twilio::Serialize::boolean_to_string($options->{record}),
50 RecordingChannels => $options->{recording_channels},
51 RecordingConfigurationId => $options->{recording_configuration_id},
52 RecordingStatusCallback => $options->{recording_status_callback},
53 RecordingStatusCallbackEvent => $options->{recording_status_callback_event},
54 RecordingStatusCallbackMethod => $options->{recording_status_callback_method},
55 RecordingTrack => $options->{recording_track},
56 SendDigits => $options->{send_digits},
57 SipAuthPassword => $options->{sip_auth_password},
58 SipAuthUsername => $options->{sip_auth_username},
59 StatusCallback => $options->{status_callback},
60 StatusCallbackEvent => $options->{status_callback_event},
61 StatusCallbackMethod => $options->{status_callback_method},
62 TimeLimit => $options->{time_limit},
63 Timeout => $options->{timeout},
64 Trim => $options->{trim},
65 Twiml => $options->{twiml},
66 Url => $options->{url},
67 5 };
68  
69 my $response =
70 5 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
71 return Twilio::Rest::Api::V2010::Account::CallInstance->new($self->{version},
72 5 $response->get_content, $self->{solution}{account_sid});
73 }
74  
75 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
76 0 my ($self, @arguments) = @_;
77 0 return $self->read_records(@arguments);
78 }
79  
80 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
81 0 my ($self, @arguments) = @_;
82 0 return $self->stream_records(@arguments);
83 }
84  
85 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
86 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
87 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
88  
89 my $params = {
90 EndTime => Twilio::Serialize::iso8601_date_time($options->{end_time}),
91 'EndTime<' => Twilio::Serialize::iso8601_date_time($options->{end_time_before}),
92 'EndTime>' => Twilio::Serialize::iso8601_date_time($options->{end_time_after}),
93 From => $options->{from},
94 ParentCallSid => $options->{parent_call_sid},
95 StartTime => Twilio::Serialize::iso8601_date_time($options->{start_time}),
96 'StartTime<' => Twilio::Serialize::iso8601_date_time($options->{start_time_before}),
97 'StartTime>' => Twilio::Serialize::iso8601_date_time($options->{start_time_after}),
98 Status => $options->{status},
99 To => $options->{to},
100 1 PageToken => $page_token,
101 Page => $page_number,
102 PageSize => $page_size,
103 };
104  
105 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
106 1 return $self->_build_page($response);
107 }
108  
109 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
110 0 my ($self, $target_url) = @_;
111 0 my $client = $self->{version}->get_domain->get_client;
112 0 return $self->_build_page($client->request('GET', $target_url));
113 }
114  
115 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
116 1 my ($self, $response) = @_;
117 return Twilio::Rest::Api::V2010::Account::CallPage->new($self->{version}, $response,
118 1 $self->{solution});
119 }
120  
121 30 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
122 30 my ($self, $sid) = @_;
123 return Twilio::Rest::Api::V2010::Account::CallContext->new($self->{version},
124 30 $self->{solution}{account_sid}, $sid);
125 }
126  
127 package Twilio::Rest::Api::V2010::Account::CallPage;
128  
129 4 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
130  
131 1 ▶sub records_key { return 'calls' }
Subroutine records_key: called CC=1 SCAR=0.0
132  
133 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
134 1 my ($self, $payload) = @_;
135 return Twilio::Rest::Api::V2010::Account::CallInstance->new($self->{version}, $payload,
136 1 $self->{solution}{account_sid});
137 }
138  
139 package Twilio::Rest::Api::V2010::Account::CallContext;
140  
141 4 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
142  
143 4 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
144  
145 30 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
146 30 my ($class, $version, $account_sid, $sid) = @_;
147 30 my $self = $class->SUPER::new($version);
148 30 $self->{solution} = { account_sid => $account_sid, sid => $sid };
149 30 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid), '/Calls/',
150 Twilio::Serialize::path_segment($sid), '.json';
151 30 return $self;
152 }
153  
154 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
155 1 my ($self) = @_;
156 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
157 1 return 1;
158 }
159  
160 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
161 1 my ($self) = @_;
162  
163 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
164 1 return $self->_build_instance($response);
165 }
166  
167 2 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
168 2 my ($self, $options) = @_;
169 2 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
20
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
170  
171 my $data = {
172 FallbackMethod => $options->{fallback_method},
173 FallbackUrl => $options->{fallback_url},
174 Method => $options->{method},
175 Status => $options->{status},
176 StatusCallback => $options->{status_callback},
177 StatusCallbackMethod => $options->{status_callback_method},
178 TimeLimit => $options->{time_limit},
179 Twiml => $options->{twiml},
180 Url => $options->{url},
181 2 };
182  
183 my $response =
184 2 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
185 2 return $self->_build_instance($response);
186 }
187  
188 3 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
189 3 my ($self, $response) = @_;
190 return Twilio::Rest::Api::V2010::Account::CallInstance->new(
191 $self->{version}, $response->get_content,
192 $self->{solution}{account_sid}, $self->{solution}{sid}
193 3 );
194 }
195  
196 1 ▶sub events {
Subroutine events: called CC=1 SCAR=0.0
197 1 my ($self) = @_;
198 1 require Twilio::Rest::Api::V2010::Account::Call::Event;
199 return Twilio::Rest::Api::V2010::Account::Call::EventList->new(
200 $self->{version},
201 $self->{solution}{account_sid},
202 $self->{solution}{sid}
203 1 );
204 }
205  
206 2 ▶sub notifications {
Subroutine notifications: called CC=2 SCAR=6.9
207 2 my ($self, $sid) = @_;
208 2 require Twilio::Rest::Api::V2010::Account::Call::Notification;
209 my $list = Twilio::Rest::Api::V2010::Account::Call::NotificationList->new(
210 $self->{version},
211 $self->{solution}{account_sid},
212 $self->{solution}{sid}
213 2 );
214 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
215 }
216  
217 2 ▶sub payments {
Subroutine payments: called CC=2 SCAR=6.9
218 2 my ($self, $sid) = @_;
219 2 require Twilio::Rest::Api::V2010::Account::Call::Payment;
220 my $list = Twilio::Rest::Api::V2010::Account::Call::PaymentList->new(
221 $self->{version},
222 $self->{solution}{account_sid},
223 $self->{solution}{sid}
224 2 );
225 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
226 }
227  
228 8 ▶sub recordings {
Subroutine recordings: called CC=2 SCAR=6.9
229 8 my ($self, $sid) = @_;
230 8 require Twilio::Rest::Api::V2010::Account::Call::Recording;
231 my $list = Twilio::Rest::Api::V2010::Account::Call::RecordingList->new(
232 $self->{version},
233 $self->{solution}{account_sid},
234 $self->{solution}{sid}
235 8 );
236 8 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 4 4 8
237 }
238  
239 2 ▶sub siprec {
Subroutine siprec: called CC=2 SCAR=6.9
240 2 my ($self, $sid) = @_;
241 2 require Twilio::Rest::Api::V2010::Account::Call::Siprec;
242 my $list = Twilio::Rest::Api::V2010::Account::Call::SiprecList->new(
243 $self->{version},
244 $self->{solution}{account_sid},
245 $self->{solution}{sid}
246 2 );
247 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
248 }
249  
250 2 ▶sub streams {
Subroutine streams: called CC=2 SCAR=6.9
251 2 my ($self, $sid) = @_;
252 2 require Twilio::Rest::Api::V2010::Account::Call::Stream;
253 my $list = Twilio::Rest::Api::V2010::Account::Call::StreamList->new(
254 $self->{version},
255 $self->{solution}{account_sid},
256 $self->{solution}{sid}
257 2 );
258 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
259 }
260  
261 2 ▶sub transcriptions {
Subroutine transcriptions: called CC=2 SCAR=6.9
262 2 my ($self, $sid) = @_;
263 2 require Twilio::Rest::Api::V2010::Account::Call::Transcription;
264 my $list = Twilio::Rest::Api::V2010::Account::Call::TranscriptionList->new(
265 $self->{version},
266 $self->{solution}{account_sid},
267 $self->{solution}{sid}
268 2 );
269 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
270 }
271  
272 1 ▶sub user_defined_messages {
Subroutine user_defined_messages: called CC=1 SCAR=0.0
273 1 my ($self) = @_;
274 1 require Twilio::Rest::Api::V2010::Account::Call::UserDefinedMessage;
275 return Twilio::Rest::Api::V2010::Account::Call::UserDefinedMessageList->new(
276 $self->{version},
277 $self->{solution}{account_sid},
278 $self->{solution}{sid}
279 1 );
280 }
281  
282 2 ▶sub user_defined_message_subscriptions {
Subroutine user_defined_message_subscriptions: called CC=2 SCAR=6.9
283 2 my ($self, $sid) = @_;
284 2 require Twilio::Rest::Api::V2010::Account::Call::UserDefinedMessageSubscription;
285 my $list = Twilio::Rest::Api::V2010::Account::Call::UserDefinedMessageSubscriptionList->new(
286 $self->{version},
287 $self->{solution}{account_sid},
288 $self->{solution}{sid}
289 2 );
290 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
291 }
292  
293 package Twilio::Rest::Api::V2010::Account::CallInstance;
294  
295 4 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
296  
297 4 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
298  
299 9 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
300 9 my ($class, $version, $payload, $account_sid, $sid) = @_;
301 9 my $self = $class->SUPER::new($version, $payload);
302 9 ▶ $self->{solution} = { account_sid => $account_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
360
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
303 9 return $self;
304 }
305  
306 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
307 0 my ($self, @arguments) = @_;
308 0 return $self->_context->delete(@arguments);
309 }
310  
311 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
312 0 my ($self, @arguments) = @_;
313 0 return $self->_context->fetch(@arguments);
314 }
315  
316 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
317 0 my ($self, @arguments) = @_;
318 0 return $self->_context->update(@arguments);
319 }
320  
321 0 ▶sub events {
Subroutine events: not called CC=1 SCAR=6.9
322 0 my ($self, @arguments) = @_;
323 0 return $self->_context->events(@arguments);
324 }
325  
326 0 ▶sub notifications {
Subroutine notifications: not called CC=1 SCAR=6.9
327 0 my ($self, @arguments) = @_;
328 0 return $self->_context->notifications(@arguments);
329 }
330  
331 0 ▶sub payments {
Subroutine payments: not called CC=1 SCAR=6.9
332 0 my ($self, @arguments) = @_;
333 0 return $self->_context->payments(@arguments);
334 }
335  
336 0 ▶sub recordings {
Subroutine recordings: not called CC=1 SCAR=6.9
337 0 my ($self, @arguments) = @_;
338 0 return $self->_context->recordings(@arguments);
339 }
340  
341 0 ▶sub siprec {
Subroutine siprec: not called CC=1 SCAR=6.9
342 0 my ($self, @arguments) = @_;
343 0 return $self->_context->siprec(@arguments);
344 }
345  
346 0 ▶sub streams {
Subroutine streams: not called CC=1 SCAR=6.9
347 0 my ($self, @arguments) = @_;
348 0 return $self->_context->streams(@arguments);
349 }
350  
351 0 ▶sub transcriptions {
Subroutine transcriptions: not called CC=1 SCAR=6.9
352 0 my ($self, @arguments) = @_;
353 0 return $self->_context->transcriptions(@arguments);
354 }
355  
356 0 ▶sub user_defined_messages {
Subroutine user_defined_messages: not called CC=1 SCAR=6.9
357 0 my ($self, @arguments) = @_;
358 0 return $self->_context->user_defined_messages(@arguments);
359 }
360  
361 0 ▶sub user_defined_message_subscriptions {
Subroutine user_defined_message_subscriptions: not called CC=1 SCAR=6.9
362 0 my ($self, @arguments) = @_;
363 0 return $self->_context->user_defined_message_subscriptions(@arguments);
364 }
365  
366 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
367 0 my ($self) = @_;
368 return Twilio::Rest::Api::V2010::Account::CallContext->new(
369 $self->{version},
370 $self->{solution}{account_sid},
371 $self->{solution}{sid}
372 0 );
373 }
374  
375 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
376 4 ▶sub answered_by { return $_[0]{properties}{answered_by} }
Subroutine answered_by: called CC=1 SCAR=0.0
377 4 ▶sub api_version { return $_[0]{properties}{api_version} }
Subroutine api_version: called CC=1 SCAR=0.0
378 4 ▶sub caller_name { return $_[0]{properties}{caller_name} }
Subroutine caller_name: called CC=1 SCAR=0.0
379 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
380 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
381 4 ▶sub direction { return $_[0]{properties}{direction} }
Subroutine direction: called CC=1 SCAR=0.0
382 4 ▶sub duration { return $_[0]{properties}{duration} }
Subroutine duration: called CC=1 SCAR=0.0
383 4 ▶sub end_time { return Twilio::Deserialize::date_time($_[0]{properties}{end_time}) }
Subroutine end_time: called CC=1 SCAR=0.0
384 4 ▶sub forwarded_from { return $_[0]{properties}{forwarded_from} }
Subroutine forwarded_from: called CC=1 SCAR=0.0
385 4 ▶sub from { return $_[0]{properties}{from} }
Subroutine from: called CC=1 SCAR=0.0
386 4 ▶sub from_formatted { return $_[0]{properties}{from_formatted} }
Subroutine from_formatted: called CC=1 SCAR=0.0
387 4 ▶sub group_sid { return $_[0]{properties}{group_sid} }
Subroutine group_sid: called CC=1 SCAR=0.0
388 4 ▶sub parent_call_sid { return $_[0]{properties}{parent_call_sid} }
Subroutine parent_call_sid: called CC=1 SCAR=0.0
389 4 ▶sub phone_number_sid { return $_[0]{properties}{phone_number_sid} }
Subroutine phone_number_sid: called CC=1 SCAR=0.0
390 4 ▶sub price { return $_[0]{properties}{price} }
Subroutine price: called CC=1 SCAR=0.0
391 4 ▶sub price_unit { return $_[0]{properties}{price_unit} }
Subroutine price_unit: called CC=1 SCAR=0.0
392 4 ▶sub queue_time { return $_[0]{properties}{queue_time} }
Subroutine queue_time: called CC=1 SCAR=0.0
393 7 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
394 4 ▶sub start_time { return Twilio::Deserialize::date_time($_[0]{properties}{start_time}) }
Subroutine start_time: called CC=1 SCAR=0.0
395 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
396 4 ▶sub stir_verstat { return $_[0]{properties}{stir_verstat} }
Subroutine stir_verstat: called CC=1 SCAR=0.0
397 4 ▶sub subresource_uris { return $_[0]{properties}{subresource_uris} }
Subroutine subresource_uris: called CC=1 SCAR=0.0
398 4 ▶sub to { return $_[0]{properties}{to} }
Subroutine to: called CC=1 SCAR=0.0
399 4 ▶sub to_formatted { return $_[0]{properties}{to_formatted} }
Subroutine to_formatted: called CC=1 SCAR=0.0
400 4 ▶sub trunk_sid { return $_[0]{properties}{trunk_sid} }
Subroutine trunk_sid: called CC=1 SCAR=0.0
401 4 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
402  
403 4 1;
404  
405 __END__
« Twilio/Rest/FlexApi/V1/InsightsQuestionnairesCategory.pm ↑ Summary Twilio/Rest/Messaging/V1/Service.pm »