Twilio/Rest/Verify/V2/Service/Entity/Challenge.pm

filter: Statementstmt 85.7% 90 / 105 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 85.1% 40 / 47 Podpod n/a totaltotal 81.3% 135 / 166 CC 5 SCAR 2.6
CC
5
Cov
83%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Trusthub/V1/SupportingDocumentType.pm ↑ Summary Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Verify::V2::Service::Entity::Challenge;
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::Verify::V2::Service::Entity::ChallengeList;
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, $identity) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { service_sid => $service_sid, identity => $identity };
19 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/Entities/', Twilio::Serialize::path_segment($identity), '/Challenges';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $factor_sid, $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 FactorSid => $factor_sid,
30 AuthPayload => $options->{auth_payload},
31 'Details.Fields' =>
32 Twilio::Serialize::map_values($options->{details_fields}, \&Twilio::Serialize::json_object),
33 'Details.Message' => $options->{details_message},
34 ExpirationDate => Twilio::Serialize::iso8601_date_time($options->{expiration_date}),
35 1 HiddenDetails => Twilio::Serialize::json_object($options->{hidden_details}),
36 };
37  
38 my $response =
39 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
40 return Twilio::Rest::Verify::V2::Service::Entity::ChallengeInstance->new(
41 $self->{version}, $response->get_content,
42 $self->{solution}{service_sid},
43 $self->{solution}{identity}
44 1 );
45 }
46  
47 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->read_records(@arguments);
50 }
51  
52 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
53 0 my ($self, @arguments) = @_;
54 0 return $self->stream_records(@arguments);
55 }
56  
57 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
58 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
59 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
60  
61 my $params = {
62 FactorSid => $options->{factor_sid},
63 Order => $options->{order},
64 Status => $options->{status},
65 1 PageToken => $page_token,
66 Page => $page_number,
67 PageSize => $page_size,
68 };
69  
70 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
71 1 return $self->_build_page($response);
72 }
73  
74 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
75 0 my ($self, $target_url) = @_;
76 0 my $client = $self->{version}->get_domain->get_client;
77 0 return $self->_build_page($client->request('GET', $target_url));
78 }
79  
80 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
81 1 my ($self, $response) = @_;
82 return Twilio::Rest::Verify::V2::Service::Entity::ChallengePage->new($self->{version}, $response,
83 1 $self->{solution});
84 }
85  
86 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
87 3 my ($self, $sid) = @_;
88 return Twilio::Rest::Verify::V2::Service::Entity::ChallengeContext->new(
89 $self->{version},
90 $self->{solution}{service_sid},
91 3 $self->{solution}{identity}, $sid
92 );
93 }
94  
95 package Twilio::Rest::Verify::V2::Service::Entity::ChallengePage;
96  
97 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 1 ▶sub records_key { return 'challenges' }
Subroutine records_key: called CC=1 SCAR=0.0
100  
101 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
102 1 my ($self, $payload) = @_;
103 return Twilio::Rest::Verify::V2::Service::Entity::ChallengeInstance->new(
104 $self->{version}, $payload,
105 $self->{solution}{service_sid},
106 $self->{solution}{identity}
107 1 );
108 }
109  
110 package Twilio::Rest::Verify::V2::Service::Entity::ChallengeContext;
111  
112 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
113  
114 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
115  
116 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
117 3 my ($class, $version, $service_sid, $identity, $sid) = @_;
118 3 my $self = $class->SUPER::new($version);
119 3 $self->{solution} = { service_sid => $service_sid, identity => $identity, sid => $sid };
120 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
121 '/Entities/', Twilio::Serialize::path_segment($identity), '/Challenges/',
122 Twilio::Serialize::path_segment($sid);
123 3 return $self;
124 }
125  
126 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
127 1 my ($self) = @_;
128  
129 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
130 1 return $self->_build_instance($response);
131 }
132  
133 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
134 1 my ($self, $options) = @_;
135 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
136  
137 my $data = {
138 AuthPayload => $options->{auth_payload},
139 1 Metadata => Twilio::Serialize::json_object($options->{metadata}),
140 };
141  
142 my $response =
143 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
144 1 return $self->_build_instance($response);
145 }
146  
147 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
148 2 my ($self, $response) = @_;
149 return Twilio::Rest::Verify::V2::Service::Entity::ChallengeInstance->new(
150 $self->{version}, $response->get_content,
151 $self->{solution}{service_sid},
152 $self->{solution}{identity},
153 $self->{solution}{sid}
154 2 );
155 }
156  
157 1 ▶sub notifications {
Subroutine notifications: called CC=1 SCAR=0.0
158 1 my ($self) = @_;
159 1 require Twilio::Rest::Verify::V2::Service::Entity::Challenge::Notification;
160 return Twilio::Rest::Verify::V2::Service::Entity::Challenge::NotificationList->new(
161 $self->{version},
162 $self->{solution}{service_sid},
163 $self->{solution}{identity},
164 $self->{solution}{sid}
165 1 );
166 }
167  
168 package Twilio::Rest::Verify::V2::Service::Entity::ChallengeInstance;
169  
170 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
171  
172 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
173  
174 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
175 4 my ($class, $version, $payload, $service_sid, $identity, $sid) = @_;
176 4 my $self = $class->SUPER::new($version, $payload);
177 $self->{solution} =
178 4 ▶ { service_sid => $service_sid, identity => $identity, 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
179 4 return $self;
180 }
181  
182 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->fetch(@arguments);
185 }
186  
187 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
188 0 my ($self, @arguments) = @_;
189 0 return $self->_context->update(@arguments);
190 }
191  
192 0 ▶sub notifications {
Subroutine notifications: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->notifications(@arguments);
195 }
196  
197 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
198 0 my ($self) = @_;
199 return Twilio::Rest::Verify::V2::Service::Entity::ChallengeContext->new(
200 $self->{version},
201 $self->{solution}{service_sid},
202 $self->{solution}{identity},
203 $self->{solution}{sid}
204 0 );
205 }
206  
207 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
208 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
209 4 ▶sub date_responded { return Twilio::Deserialize::date_time($_[0]{properties}{date_responded}) }
Subroutine date_responded: called CC=1 SCAR=0.0
210 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
211 4 ▶sub details { return $_[0]{properties}{details} }
Subroutine details: called CC=1 SCAR=0.0
212 4 ▶sub entity_sid { return $_[0]{properties}{entity_sid} }
Subroutine entity_sid: called CC=1 SCAR=0.0
213 4 ▶sub expiration_date { return Twilio::Deserialize::date_time($_[0]{properties}{expiration_date}) }
Subroutine expiration_date: called CC=1 SCAR=0.0
214 4 ▶sub factor_sid { return $_[0]{properties}{factor_sid} }
Subroutine factor_sid: called CC=1 SCAR=0.0
215 4 ▶sub factor_type { return $_[0]{properties}{factor_type} }
Subroutine factor_type: called CC=1 SCAR=0.0
216 4 ▶sub hidden_details { return $_[0]{properties}{hidden_details} }
Subroutine hidden_details: called CC=1 SCAR=0.0
217 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
218 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
219 4 ▶sub metadata { return $_[0]{properties}{metadata} }
Subroutine metadata: called CC=1 SCAR=0.0
220 4 ▶sub responded_reason { return $_[0]{properties}{responded_reason} }
Subroutine responded_reason: called CC=1 SCAR=0.0
221 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
222 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
223 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
224 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
225  
226 2 1;
227  
228 __END__
« Twilio/Rest/Trusthub/V1/SupportingDocumentType.pm ↑ Summary Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn.pm »