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

filter: Statementstmt 81.7% 85 / 104 Branchbran 100% 4 / 4 Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 78.0% 32 / 41 Podpod n/a totaltotal 78.9% 124 / 157 CC 5 SCAR 3.2
CC
5
Cov
81%
page
2.0
new
2.0
read
2.0
CRAP 1.4
« Twilio/Rest/Events/V1/Subscription.pm ↑ Summary Twilio/Rest/Chat/V2/Service/Channel/Member.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;
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::EntityList;
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 14 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 14 my ($class, $version, $service_sid) = @_;
17 14 my $self = $class->SUPER::new($version);
18 14 $self->{solution} = { service_sid => $service_sid };
19 14 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Entities';
20 14 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 1 my ($self, $identity) = @_;
25  
26 1 my $data = { Identity => $identity, };
27  
28 my $response =
29 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
30 return Twilio::Rest::Verify::V2::Service::EntityInstance->new($self->{version},
31 1 $response->get_content, $self->{solution}{service_sid});
32 }
33  
34 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
35 0 my ($self, @arguments) = @_;
36 0 return $self->read_records(@arguments);
37 }
38  
39 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->stream_records(@arguments);
42 }
43  
44 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
45 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
46 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
47  
48 1 my $params = {
49 PageToken => $page_token,
50 Page => $page_number,
51 PageSize => $page_size,
52 };
53  
54 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
55 1 return $self->_build_page($response);
56 }
57  
58 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
59 0 my ($self, $target_url) = @_;
60 0 my $client = $self->{version}->get_domain->get_client;
61 0 return $self->_build_page($client->request('GET', $target_url));
62 }
63  
64 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
65 1 my ($self, $response) = @_;
66 return Twilio::Rest::Verify::V2::Service::EntityPage->new($self->{version}, $response,
67 1 $self->{solution});
68 }
69  
70 12 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
71 12 my ($self, $identity) = @_;
72 return Twilio::Rest::Verify::V2::Service::EntityContext->new($self->{version},
73 12 $self->{solution}{service_sid}, $identity);
74 }
75  
76 package Twilio::Rest::Verify::V2::Service::EntityPage;
77  
78 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
79  
80 1 ▶sub records_key { return 'entities' }
Subroutine records_key: called CC=1 SCAR=0.0
81  
82 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
83 1 my ($self, $payload) = @_;
84 return Twilio::Rest::Verify::V2::Service::EntityInstance->new($self->{version}, $payload,
85 1 $self->{solution}{service_sid});
86 }
87  
88 package Twilio::Rest::Verify::V2::Service::EntityContext;
89  
90 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 12 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
95 12 my ($class, $version, $service_sid, $identity) = @_;
96 12 my $self = $class->SUPER::new($version);
97 12 $self->{solution} = { service_sid => $service_sid, identity => $identity };
98 12 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
99 '/Entities/', Twilio::Serialize::path_segment($identity);
100 12 return $self;
101 }
102  
103 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
104 1 my ($self) = @_;
105 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
106 1 return 1;
107 }
108  
109 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
110 1 my ($self) = @_;
111  
112 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
113 1 return $self->_build_instance($response);
114 }
115  
116 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
117 1 my ($self, $response) = @_;
118 return Twilio::Rest::Verify::V2::Service::EntityInstance->new(
119 $self->{version}, $response->get_content,
120 $self->{solution}{service_sid},
121 $self->{solution}{identity}
122 1 );
123 }
124  
125 5 ▶sub challenges {
Subroutine challenges: called CC=2 SCAR=6.9
126 5 my ($self, $sid) = @_;
127 5 require Twilio::Rest::Verify::V2::Service::Entity::Challenge;
128 my $list = Twilio::Rest::Verify::V2::Service::Entity::ChallengeList->new(
129 $self->{version},
130 $self->{solution}{service_sid},
131 $self->{solution}{identity}
132 5 );
133 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
134 }
135  
136 4 ▶sub factors {
Subroutine factors: called CC=2 SCAR=6.9
137 4 my ($self, $sid) = @_;
138 4 require Twilio::Rest::Verify::V2::Service::Entity::Factor;
139 my $list = Twilio::Rest::Verify::V2::Service::Entity::FactorList->new(
140 $self->{version},
141 $self->{solution}{service_sid},
142 $self->{solution}{identity}
143 4 );
144 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 1 4
145 }
146  
147 1 ▶sub new_factors {
Subroutine new_factors: called CC=1 SCAR=0.0
148 1 my ($self) = @_;
149 1 require Twilio::Rest::Verify::V2::Service::Entity::NewFactor;
150 return Twilio::Rest::Verify::V2::Service::Entity::NewFactorList->new(
151 $self->{version},
152 $self->{solution}{service_sid},
153 $self->{solution}{identity}
154 1 );
155 }
156  
157 package Twilio::Rest::Verify::V2::Service::EntityInstance;
158  
159 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
160  
161 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
162  
163 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
164 3 my ($class, $version, $payload, $service_sid, $identity) = @_;
165 3 my $self = $class->SUPER::new($version, $payload);
166 $self->{solution} =
167 3 ▶ { service_sid => $service_sid, identity => $identity // $self->{properties}{identity} };
Condition66%2/3
$identity // $self->{"properties"}{"identity"}
l!l&&r!l&&!r
120
MC/DC0%0/2
$identity // $self->{"properties"}{"identity"}
$identity $self->{"properties"}{"identity"}
Truth table66%2/3
A // B
A= $identityB= $self->{"properties"}{"identity"}
ABresult
1X1
011
000
168 3 return $self;
169 }
170  
171 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->delete(@arguments);
174 }
175  
176 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
177 0 my ($self, @arguments) = @_;
178 0 return $self->_context->fetch(@arguments);
179 }
180  
181 0 ▶sub challenges {
Subroutine challenges: not called CC=1 SCAR=6.9
182 0 my ($self, @arguments) = @_;
183 0 return $self->_context->challenges(@arguments);
184 }
185  
186 0 ▶sub factors {
Subroutine factors: not called CC=1 SCAR=6.9
187 0 my ($self, @arguments) = @_;
188 0 return $self->_context->factors(@arguments);
189 }
190  
191 0 ▶sub new_factors {
Subroutine new_factors: not called CC=1 SCAR=6.9
192 0 my ($self, @arguments) = @_;
193 0 return $self->_context->new_factors(@arguments);
194 }
195  
196 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
197 0 my ($self) = @_;
198 return Twilio::Rest::Verify::V2::Service::EntityContext->new(
199 $self->{version},
200 $self->{solution}{service_sid},
201 $self->{solution}{identity}
202 0 );
203 }
204  
205 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
206 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
207 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
208 3 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
209 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
210 3 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
211 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
212 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
213  
214 2 1;
215  
216 __END__
« Twilio/Rest/Events/V1/Subscription.pm ↑ Summary Twilio/Rest/Chat/V2/Service/Channel/Member.pm »