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

filter: Statementstmt 84.2% 80 / 95 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 82.9% 34 / 41 Podpod n/a totaltotal 80.2% 118 / 147 CC 4 SCAR 2.6
CC
4
Cov
82%
page
2.0
update
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Verify/V2/Service/MessagingConfiguration.pm ↑ Summary Twilio/Rest/Serverless/V1/Service/Build.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::Factor;
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::FactorList;
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 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 4 my ($class, $version, $service_sid, $identity) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { service_sid => $service_sid, identity => $identity };
19 4 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/Entities/', Twilio::Serialize::path_segment($identity), '/Factors';
21 4 return $self;
22 }
23  
24 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
25 0 my ($self, @arguments) = @_;
26 0 return $self->read_records(@arguments);
27 }
28  
29 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
30 0 my ($self, @arguments) = @_;
31 0 return $self->stream_records(@arguments);
32 }
33  
34 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
35 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
36 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
37  
38 1 my $params = {
39 PageToken => $page_token,
40 Page => $page_number,
41 PageSize => $page_size,
42 };
43  
44 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
45 1 return $self->_build_page($response);
46 }
47  
48 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
49 0 my ($self, $target_url) = @_;
50 0 my $client = $self->{version}->get_domain->get_client;
51 0 return $self->_build_page($client->request('GET', $target_url));
52 }
53  
54 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
55 1 my ($self, $response) = @_;
56 return Twilio::Rest::Verify::V2::Service::Entity::FactorPage->new($self->{version}, $response,
57 1 $self->{solution});
58 }
59  
60 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
61 3 my ($self, $sid) = @_;
62 return Twilio::Rest::Verify::V2::Service::Entity::FactorContext->new(
63 $self->{version},
64 $self->{solution}{service_sid},
65 3 $self->{solution}{identity}, $sid
66 );
67 }
68  
69 package Twilio::Rest::Verify::V2::Service::Entity::FactorPage;
70  
71 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 1 ▶sub records_key { return 'factors' }
Subroutine records_key: called CC=1 SCAR=0.0
74  
75 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
76 1 my ($self, $payload) = @_;
77 return Twilio::Rest::Verify::V2::Service::Entity::FactorInstance->new(
78 $self->{version}, $payload,
79 $self->{solution}{service_sid},
80 $self->{solution}{identity}
81 1 );
82 }
83  
84 package Twilio::Rest::Verify::V2::Service::Entity::FactorContext;
85  
86 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
91 3 my ($class, $version, $service_sid, $identity, $sid) = @_;
92 3 my $self = $class->SUPER::new($version);
93 3 $self->{solution} = { service_sid => $service_sid, identity => $identity, sid => $sid };
94 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
95 '/Entities/', Twilio::Serialize::path_segment($identity), '/Factors/',
96 Twilio::Serialize::path_segment($sid);
97 3 return $self;
98 }
99  
100 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
101 1 my ($self) = @_;
102 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
103 1 return 1;
104 }
105  
106 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
107 1 my ($self) = @_;
108  
109 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
110 1 return $self->_build_instance($response);
111 }
112  
113 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
114 1 my ($self, $options) = @_;
115 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
116  
117 my $data = {
118 AuthPayload => $options->{auth_payload},
119 'Config.Alg' => $options->{config_alg},
120 'Config.CodeLength' => $options->{config_code_length},
121 'Config.NotificationPlatform' => $options->{config_notification_platform},
122 'Config.NotificationToken' => $options->{config_notification_token},
123 'Config.SdkVersion' => $options->{config_sdk_version},
124 'Config.Skew' => $options->{config_skew},
125 'Config.TimeStep' => $options->{config_time_step},
126 FriendlyName => $options->{friendly_name},
127 1 };
128  
129 my $response =
130 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
131 1 return $self->_build_instance($response);
132 }
133  
134 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
135 2 my ($self, $response) = @_;
136 return Twilio::Rest::Verify::V2::Service::Entity::FactorInstance->new(
137 $self->{version}, $response->get_content,
138 $self->{solution}{service_sid},
139 $self->{solution}{identity},
140 $self->{solution}{sid}
141 2 );
142 }
143  
144 package Twilio::Rest::Verify::V2::Service::Entity::FactorInstance;
145  
146 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
149  
150 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
151 3 my ($class, $version, $payload, $service_sid, $identity, $sid) = @_;
152 3 my $self = $class->SUPER::new($version, $payload);
153 $self->{solution} =
154 3 ▶ { service_sid => $service_sid, identity => $identity, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
210
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
155 3 return $self;
156 }
157  
158 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
159 0 my ($self, @arguments) = @_;
160 0 return $self->_context->delete(@arguments);
161 }
162  
163 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
164 0 my ($self, @arguments) = @_;
165 0 return $self->_context->fetch(@arguments);
166 }
167  
168 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
169 0 my ($self, @arguments) = @_;
170 0 return $self->_context->update(@arguments);
171 }
172  
173 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
174 0 my ($self) = @_;
175 return Twilio::Rest::Verify::V2::Service::Entity::FactorContext->new(
176 $self->{version},
177 $self->{solution}{service_sid},
178 $self->{solution}{identity},
179 $self->{solution}{sid}
180 0 );
181 }
182  
183 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
184 3 ▶sub config { return $_[0]{properties}{config} }
Subroutine config: called CC=1 SCAR=0.0
185 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
186 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
187 3 ▶sub entity_sid { return $_[0]{properties}{entity_sid} }
Subroutine entity_sid: called CC=1 SCAR=0.0
188 3 ▶sub factor_type { return $_[0]{properties}{factor_type} }
Subroutine factor_type: called CC=1 SCAR=0.0
189 3 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
190 3 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
191 3 ▶sub metadata { return $_[0]{properties}{metadata} }
Subroutine metadata: called CC=1 SCAR=0.0
192 3 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
193 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
194 3 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
195 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
196  
197 2 1;
198  
199 __END__
« Twilio/Rest/Verify/V2/Service/MessagingConfiguration.pm ↑ Summary Twilio/Rest/Serverless/V1/Service/Build.pm »