Twilio/Rest/Verify/V2/Service.pm

filter: Statementstmt 78.1% 132 / 169 Branchbran 100% 12 / 12 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 75.0% 54 / 72 Podpod n/a totaltotal 76.0% 203 / 267 CC 11 SCAR 3.8
CC
11
Cov
78%
create
2.0
page
2.0
update
2.0
CRAP 1.5
« Twilio/Rest/Serverless/V1/Service.pm ↑ Summary Twilio/Rest/Conversations/V1/Service.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Verify::V2::Service;
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::Verify::V2::ServiceList;
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 53 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 53 my ($class, $version) = @_;
17 53 my $self = $class->SUPER::new($version);
18 53 $self->{solution} = {};
19 53 $self->{uri} = '/Services';
20 53 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $friendly_name, $options) = @_;
25 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
26  
27 my $data = {
28 FriendlyName => $friendly_name,
29 CodeLength => $options->{code_length},
30 CustomCodeEnabled => Twilio::Serialize::boolean_to_string($options->{custom_code_enabled}),
31 DefaultTemplateSid => $options->{default_template_sid},
32 DoNotShareWarningEnabled =>
33 Twilio::Serialize::boolean_to_string($options->{do_not_share_warning_enabled}),
34 DtmfInputRequired => Twilio::Serialize::boolean_to_string($options->{dtmf_input_required}),
35 LookupEnabled => Twilio::Serialize::boolean_to_string($options->{lookup_enabled}),
36 'Passkeys.AuthenticatorAttachment' => $options->{passkeys_authenticator_attachment},
37 'Passkeys.DiscoverableCredentials' => $options->{passkeys_discoverable_credentials},
38 'Passkeys.RelyingParty.Id' => $options->{passkeys_relying_party_id},
39 'Passkeys.RelyingParty.Name' => $options->{passkeys_relying_party_name},
40 'Passkeys.RelyingParty.Origins' => $options->{passkeys_relying_party_origins},
41 'Passkeys.UserVerification' => $options->{passkeys_user_verification},
42 Psd2Enabled => Twilio::Serialize::boolean_to_string($options->{psd2_enabled}),
43 'Push.ApnCredentialSid' => $options->{push_apn_credential_sid},
44 'Push.FcmCredentialSid' => $options->{push_fcm_credential_sid},
45 'Push.IncludeDate' => Twilio::Serialize::boolean_to_string($options->{push_include_date}),
46 SkipSmsToLandlines => Twilio::Serialize::boolean_to_string($options->{skip_sms_to_landlines}),
47 'Totp.CodeLength' => $options->{totp_code_length},
48 'Totp.Issuer' => $options->{totp_issuer},
49 'Totp.Skew' => $options->{totp_skew},
50 'Totp.TimeStep' => $options->{totp_time_step},
51 TtsName => $options->{tts_name},
52 VerifyEventSubscriptionEnabled =>
53 Twilio::Serialize::boolean_to_string($options->{verify_event_subscription_enabled}),
54 'Whatsapp.From' => $options->{whatsapp_from},
55 'Whatsapp.MsgServiceSid' => $options->{whatsapp_msg_service_sid},
56 1 };
57  
58 my $response =
59 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
60 1 return Twilio::Rest::Verify::V2::ServiceInstance->new($self->{version}, $response->get_content);
61 }
62  
63 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
64 0 my ($self, @arguments) = @_;
65 0 return $self->read_records(@arguments);
66 }
67  
68 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
69 0 my ($self, @arguments) = @_;
70 0 return $self->stream_records(@arguments);
71 }
72  
73 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
74 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
75 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
76  
77 1 my $params = {
78 PageToken => $page_token,
79 Page => $page_number,
80 PageSize => $page_size,
81 };
82  
83 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
84 1 return $self->_build_page($response);
85 }
86  
87 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
88 0 my ($self, $target_url) = @_;
89 0 my $client = $self->{version}->get_domain->get_client;
90 0 return $self->_build_page($client->request('GET', $target_url));
91 }
92  
93 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
94 1 my ($self, $response) = @_;
95 1 return Twilio::Rest::Verify::V2::ServicePage->new($self->{version}, $response, $self->{solution});
96 }
97  
98 51 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
99 51 my ($self, $sid) = @_;
100 51 return Twilio::Rest::Verify::V2::ServiceContext->new($self->{version}, $sid);
101 }
102  
103 package Twilio::Rest::Verify::V2::ServicePage;
104  
105 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 1 ▶sub records_key { return 'services' }
Subroutine records_key: called CC=1 SCAR=0.0
108  
109 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
110 1 my ($self, $payload) = @_;
111 1 return Twilio::Rest::Verify::V2::ServiceInstance->new($self->{version}, $payload);
112 }
113  
114 package Twilio::Rest::Verify::V2::ServiceContext;
115  
116 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
117  
118 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
119  
120 51 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
121 51 my ($class, $version, $sid) = @_;
122 51 my $self = $class->SUPER::new($version);
123 51 $self->{solution} = { sid => $sid };
124 51 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
125 51 return $self;
126 }
127  
128 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
129 1 my ($self) = @_;
130 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
131 1 return 1;
132 }
133  
134 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
135 1 my ($self) = @_;
136  
137 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
138 1 return $self->_build_instance($response);
139 }
140  
141 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
142 1 my ($self, $options) = @_;
143 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
144  
145 my $data = {
146 CodeLength => $options->{code_length},
147 CustomCodeEnabled => Twilio::Serialize::boolean_to_string($options->{custom_code_enabled}),
148 DefaultTemplateSid => $options->{default_template_sid},
149 DoNotShareWarningEnabled =>
150 Twilio::Serialize::boolean_to_string($options->{do_not_share_warning_enabled}),
151 DtmfInputRequired => Twilio::Serialize::boolean_to_string($options->{dtmf_input_required}),
152 FriendlyName => $options->{friendly_name},
153 LookupEnabled => Twilio::Serialize::boolean_to_string($options->{lookup_enabled}),
154 'Passkeys.AuthenticatorAttachment' => $options->{passkeys_authenticator_attachment},
155 'Passkeys.DiscoverableCredentials' => $options->{passkeys_discoverable_credentials},
156 'Passkeys.RelyingParty.Id' => $options->{passkeys_relying_party_id},
157 'Passkeys.RelyingParty.Name' => $options->{passkeys_relying_party_name},
158 'Passkeys.RelyingParty.Origins' => $options->{passkeys_relying_party_origins},
159 'Passkeys.UserVerification' => $options->{passkeys_user_verification},
160 Psd2Enabled => Twilio::Serialize::boolean_to_string($options->{psd2_enabled}),
161 'Push.ApnCredentialSid' => $options->{push_apn_credential_sid},
162 'Push.FcmCredentialSid' => $options->{push_fcm_credential_sid},
163 'Push.IncludeDate' => Twilio::Serialize::boolean_to_string($options->{push_include_date}),
164 SkipSmsToLandlines => Twilio::Serialize::boolean_to_string($options->{skip_sms_to_landlines}),
165 'Totp.CodeLength' => $options->{totp_code_length},
166 'Totp.Issuer' => $options->{totp_issuer},
167 'Totp.Skew' => $options->{totp_skew},
168 'Totp.TimeStep' => $options->{totp_time_step},
169 TtsName => $options->{tts_name},
170 VerifyEventSubscriptionEnabled =>
171 Twilio::Serialize::boolean_to_string($options->{verify_event_subscription_enabled}),
172 'Whatsapp.From' => $options->{whatsapp_from},
173 'Whatsapp.MsgServiceSid' => $options->{whatsapp_msg_service_sid},
174 1 };
175  
176 my $response =
177 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
178 1 return $self->_build_instance($response);
179 }
180  
181 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
182 2 my ($self, $response) = @_;
183 return Twilio::Rest::Verify::V2::ServiceInstance->new($self->{version}, $response->get_content,
184 2 $self->{solution}{sid});
185 }
186  
187 3 ▶sub access_tokens {
Subroutine access_tokens: called CC=2 SCAR=6.9
188 3 my ($self, $sid) = @_;
189 3 require Twilio::Rest::Verify::V2::Service::AccessToken;
190 my $list = Twilio::Rest::Verify::V2::Service::AccessTokenList->new($self->{version},
191 3 $self->{solution}{sid});
192 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 2 3
193 }
194  
195 1 ▶sub approve_challenge {
Subroutine approve_challenge: called CC=1 SCAR=0.0
196 1 my ($self) = @_;
197 1 require Twilio::Rest::Verify::V2::Service::ApproveChallenge;
198 return Twilio::Rest::Verify::V2::Service::ApproveChallengeList->new($self->{version},
199 1 $self->{solution}{sid});
200 }
201  
202 14 ▶sub entities {
Subroutine entities: called CC=2 SCAR=6.9
203 14 my ($self, $identity) = @_;
204 14 require Twilio::Rest::Verify::V2::Service::Entity;
205 my $list =
206 14 Twilio::Rest::Verify::V2::Service::EntityList->new($self->{version}, $self->{solution}{sid});
207 14 ▶ return defined $identity ? $list->get_context($identity) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $identity ? : 12 2 14
208 }
209  
210 5 ▶sub messaging_configurations {
Subroutine messaging_configurations: called CC=2 SCAR=6.9
211 5 my ($self, $country) = @_;
212 5 require Twilio::Rest::Verify::V2::Service::MessagingConfiguration;
213 my $list = Twilio::Rest::Verify::V2::Service::MessagingConfigurationList->new($self->{version},
214 5 $self->{solution}{sid});
215 5 ▶ return defined $country ? $list->get_context($country) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $country ? : 3 2 5
216 }
217  
218 1 ▶sub new_challenge {
Subroutine new_challenge: called CC=1 SCAR=0.0
219 1 my ($self) = @_;
220 1 require Twilio::Rest::Verify::V2::Service::NewChallenge;
221 return Twilio::Rest::Verify::V2::Service::NewChallengeContext->new($self->{version},
222 1 $self->{solution}{sid});
223 }
224  
225 1 ▶sub new_factors {
Subroutine new_factors: called CC=1 SCAR=0.0
226 1 my ($self) = @_;
227 1 require Twilio::Rest::Verify::V2::Service::NewFactor;
228 return Twilio::Rest::Verify::V2::Service::NewFactorList->new($self->{version},
229 1 $self->{solution}{sid});
230 }
231  
232 1 ▶sub new_verify_factors {
Subroutine new_verify_factors: called CC=1 SCAR=0.0
233 1 my ($self) = @_;
234 1 require Twilio::Rest::Verify::V2::Service::NewVerifyFactor;
235 return Twilio::Rest::Verify::V2::Service::NewVerifyFactorList->new($self->{version},
236 1 $self->{solution}{sid});
237 }
238  
239 10 ▶sub rate_limits {
Subroutine rate_limits: called CC=2 SCAR=6.9
240 10 my ($self, $sid) = @_;
241 10 require Twilio::Rest::Verify::V2::Service::RateLimit;
242 my $list =
243 10 Twilio::Rest::Verify::V2::Service::RateLimitList->new($self->{version}, $self->{solution}{sid});
244 10 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 8 2 10
245 }
246  
247 4 ▶sub verifications {
Subroutine verifications: called CC=2 SCAR=6.9
248 4 my ($self, $sid) = @_;
249 4 require Twilio::Rest::Verify::V2::Service::Verification;
250 my $list = Twilio::Rest::Verify::V2::Service::VerificationList->new($self->{version},
251 4 $self->{solution}{sid});
252 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
253 }
254  
255 3 ▶sub verification_checks {
Subroutine verification_checks: called CC=1 SCAR=0.0
256 3 my ($self) = @_;
257 3 require Twilio::Rest::Verify::V2::Service::VerificationCheck;
258 return Twilio::Rest::Verify::V2::Service::VerificationCheckList->new($self->{version},
259 3 $self->{solution}{sid});
260 }
261  
262 5 ▶sub webhooks {
Subroutine webhooks: called CC=2 SCAR=6.9
263 5 my ($self, $sid) = @_;
264 5 require Twilio::Rest::Verify::V2::Service::Webhook;
265 my $list =
266 5 Twilio::Rest::Verify::V2::Service::WebhookList->new($self->{version}, $self->{solution}{sid});
267 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
268 }
269  
270 package Twilio::Rest::Verify::V2::ServiceInstance;
271  
272 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
273  
274 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
275  
276 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
277 4 my ($class, $version, $payload, $sid) = @_;
278 4 my $self = $class->SUPER::new($version, $payload);
279 4 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
220
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
280 4 return $self;
281 }
282  
283 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
284 0 my ($self, @arguments) = @_;
285 0 return $self->_context->delete(@arguments);
286 }
287  
288 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
289 0 my ($self, @arguments) = @_;
290 0 return $self->_context->fetch(@arguments);
291 }
292  
293 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
294 0 my ($self, @arguments) = @_;
295 0 return $self->_context->update(@arguments);
296 }
297  
298 0 ▶sub access_tokens {
Subroutine access_tokens: not called CC=1 SCAR=6.9
299 0 my ($self, @arguments) = @_;
300 0 return $self->_context->access_tokens(@arguments);
301 }
302  
303 0 ▶sub approve_challenge {
Subroutine approve_challenge: not called CC=1 SCAR=6.9
304 0 my ($self, @arguments) = @_;
305 0 return $self->_context->approve_challenge(@arguments);
306 }
307  
308 0 ▶sub entities {
Subroutine entities: not called CC=1 SCAR=6.9
309 0 my ($self, @arguments) = @_;
310 0 return $self->_context->entities(@arguments);
311 }
312  
313 0 ▶sub messaging_configurations {
Subroutine messaging_configurations: not called CC=1 SCAR=6.9
314 0 my ($self, @arguments) = @_;
315 0 return $self->_context->messaging_configurations(@arguments);
316 }
317  
318 0 ▶sub new_challenge {
Subroutine new_challenge: not called CC=1 SCAR=6.9
319 0 my ($self, @arguments) = @_;
320 0 return $self->_context->new_challenge(@arguments);
321 }
322  
323 0 ▶sub new_factors {
Subroutine new_factors: not called CC=1 SCAR=6.9
324 0 my ($self, @arguments) = @_;
325 0 return $self->_context->new_factors(@arguments);
326 }
327  
328 0 ▶sub new_verify_factors {
Subroutine new_verify_factors: not called CC=1 SCAR=6.9
329 0 my ($self, @arguments) = @_;
330 0 return $self->_context->new_verify_factors(@arguments);
331 }
332  
333 0 ▶sub rate_limits {
Subroutine rate_limits: not called CC=1 SCAR=6.9
334 0 my ($self, @arguments) = @_;
335 0 return $self->_context->rate_limits(@arguments);
336 }
337  
338 0 ▶sub verifications {
Subroutine verifications: not called CC=1 SCAR=6.9
339 0 my ($self, @arguments) = @_;
340 0 return $self->_context->verifications(@arguments);
341 }
342  
343 0 ▶sub verification_checks {
Subroutine verification_checks: not called CC=1 SCAR=6.9
344 0 my ($self, @arguments) = @_;
345 0 return $self->_context->verification_checks(@arguments);
346 }
347  
348 0 ▶sub webhooks {
Subroutine webhooks: not called CC=1 SCAR=6.9
349 0 my ($self, @arguments) = @_;
350 0 return $self->_context->webhooks(@arguments);
351 }
352  
353 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
354 0 my ($self) = @_;
355 0 return Twilio::Rest::Verify::V2::ServiceContext->new($self->{version}, $self->{solution}{sid});
356 }
357  
358 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
359 4 ▶sub code_length { return $_[0]{properties}{code_length} }
Subroutine code_length: called CC=1 SCAR=0.0
360 4 ▶sub custom_code_enabled { return $_[0]{properties}{custom_code_enabled} }
Subroutine custom_code_enabled: called CC=1 SCAR=0.0
361 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
362 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
363 4 ▶sub default_template_sid { return $_[0]{properties}{default_template_sid} }
Subroutine default_template_sid: called CC=1 SCAR=0.0
364 4 ▶sub do_not_share_warning_enabled { return $_[0]{properties}{do_not_share_warning_enabled} }
Subroutine do_not_share_warning_enabled: called CC=1 SCAR=0.0
365 4 ▶sub dtmf_input_required { return $_[0]{properties}{dtmf_input_required} }
Subroutine dtmf_input_required: called CC=1 SCAR=0.0
366 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
367 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
368 4 ▶sub lookup_enabled { return $_[0]{properties}{lookup_enabled} }
Subroutine lookup_enabled: called CC=1 SCAR=0.0
369 4 ▶sub passkeys { return $_[0]{properties}{passkeys} }
Subroutine passkeys: called CC=1 SCAR=0.0
370 4 ▶sub psd2_enabled { return $_[0]{properties}{psd2_enabled} }
Subroutine psd2_enabled: called CC=1 SCAR=0.0
371 4 ▶sub push { return $_[0]{properties}{push} }
Subroutine push: called CC=1 SCAR=0.0
372 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
373 4 ▶sub skip_sms_to_landlines { return $_[0]{properties}{skip_sms_to_landlines} }
Subroutine skip_sms_to_landlines: called CC=1 SCAR=0.0
374 4 ▶sub totp { return $_[0]{properties}{totp} }
Subroutine totp: called CC=1 SCAR=0.0
375 4 ▶sub tts_name { return $_[0]{properties}{tts_name} }
Subroutine tts_name: called CC=1 SCAR=0.0
376 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
377  
378 4 ▶sub verify_event_subscription_enabled {
Subroutine verify_event_subscription_enabled: called CC=1 SCAR=0.0
379 4 return $_[0]{properties}{verify_event_subscription_enabled};
380 }
381 4 ▶sub whatsapp { return $_[0]{properties}{whatsapp} }
Subroutine whatsapp: called CC=1 SCAR=0.0
382  
383 3 1;
384  
385 __END__
« Twilio/Rest/Serverless/V1/Service.pm ↑ Summary Twilio/Rest/Conversations/V1/Service.pm »