Twilio/Rest/Memory/V1/Identifier.pm

filter: Statementstmt 88.0% 110 / 125 Branchbran 100% 8 / 8 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 84.0% 37 / 44 Podpod n/a totaltotal 84.5% 159 / 188 CC 8 SCAR 3.7
CC
8
Cov
87%
delete
3.0
page
2.0
new
2.0
CRAP 1.5
« Twilio/Rest/Messaging/V1/Service.pm ↑ Summary Twilio/Rest/Pricing/V1/Voice.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Memory::V1::Identifier;
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::Memory::V1::IdentifierList;
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 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 9 my ($class, $version, $store_id, $profile_id) = @_;
17 9 my $self = $class->SUPER::new($version);
18 9 $self->{solution} = { store_id => $store_id, profile_id => $profile_id };
19 9 $self->{uri} = join q{}, '/Stores/', Twilio::Serialize::path_segment($store_id), '/Profiles/',
20 Twilio::Serialize::path_segment($profile_id), '/Identifiers';
21 9 return $self;
22 }
23  
24 2 ▶sub create {
Subroutine create: called CC=2 SCAR=6.9
25 2 my ($self, $body) = @_;
26  
27 2 my $data = Twilio::Serialize::json_body($body, {});
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 2 'create',
33 {
34 data => $data,
35 headers => { 'Content-Type' => 'application/json', }
36 }
37 );
38 2 my $status = $response->get_status_code;
39 return Twilio::Rest::Memory::V1::CreateProfileIdentifier202ResponseInstance->new($self->{version},
40 2 ▶ $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 202 1 1 2
41 if $status == 202;
42 return Twilio::Rest::Memory::V1::CreateProfileIdentifier308ResponseInstance->new($self->{version},
43 1 $response->get_content);
44 }
45  
46 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
47 0 my ($self, @arguments) = @_;
48 0 return $self->read_records(@arguments);
49 }
50  
51 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
52 0 my ($self, @arguments) = @_;
53 0 return $self->stream_records(@arguments);
54 }
55  
56 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
57 1 my ($self, $options, $page_size, $page_token) = @_;
58 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
59  
60 1 my $params = {
61 pageSize => $page_size,
62 pageToken => $page_token,
63 };
64  
65 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
66 1 return $self->_build_page($response);
67 }
68  
69 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
70 0 my ($self, $target_url) = @_;
71 0 my $client = $self->{version}->get_domain->get_client;
72 0 return $self->_build_page($client->request('GET', $target_url));
73 }
74  
75 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
76 1 my ($self, $response) = @_;
77 return Twilio::Rest::Memory::V1::IdentifierPage->new($self->{version}, $response,
78 1 $self->{solution});
79 }
80  
81 6 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
82 6 my ($self, $id_type) = @_;
83 return Twilio::Rest::Memory::V1::IdentifierContext->new(
84 $self->{version},
85 $self->{solution}{store_id},
86 6 $self->{solution}{profile_id}, $id_type
87 );
88 }
89  
90 package Twilio::Rest::Memory::V1::IdentifierPage;
91  
92 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 1 ▶sub records_key { return 'identifiers' }
Subroutine records_key: called CC=1 SCAR=0.0
95  
96 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
97 1 my ($self, $payload) = @_;
98 return Twilio::Rest::Memory::V1::IdentifierInstance->new(
99 $self->{version}, $payload,
100 $self->{solution}{store_id},
101 $self->{solution}{profile_id}
102 1 );
103 }
104  
105 package Twilio::Rest::Memory::V1::IdentifierContext;
106  
107 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
108  
109 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
110  
111 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
112 6 my ($class, $version, $store_id, $profile_id, $id_type) = @_;
113 6 my $self = $class->SUPER::new($version);
114 6 $self->{solution} = { store_id => $store_id, profile_id => $profile_id, id_type => $id_type };
115 6 $self->{uri} = join q{}, '/Stores/', Twilio::Serialize::path_segment($store_id), '/Profiles/',
116 Twilio::Serialize::path_segment($profile_id), '/Identifiers/',
117 Twilio::Serialize::path_segment($id_type);
118 6 return $self;
119 }
120  
121 2 ▶sub delete {
Subroutine delete: called CC=3 SCAR=11.0
122 2 my ($self, $options) = @_;
123 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
124 my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
125 2 { params => { removeAll => Twilio::Serialize::boolean_to_string($options->{remove_all}), } });
126 2 my $status = $response->get_status_code;
127 return Twilio::Rest::Memory::V1::CreateProfileIdentifier308ResponseInstance->new($self->{version},
128 2 ▶ $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 308 1 1 2
129 if $status == 308;
130 return Twilio::Rest::Memory::V1::DeleteProfileIdentifier202ResponseInstance->new($self->{version},
131 1 $response->get_content);
132 }
133  
134 2 ▶sub fetch {
Subroutine fetch: called CC=2 SCAR=6.9
135 2 my ($self) = @_;
136  
137 2 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
138 2 my $status = $response->get_status_code;
139 return Twilio::Rest::Memory::V1::CreateProfileIdentifier308ResponseInstance->new($self->{version},
140 2 ▶ $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 301 1 1 2
141 if $status == 301;
142 1 return $self->_build_instance($response);
143 }
144  
145 2 ▶sub patch {
Subroutine patch: called CC=2 SCAR=6.9
146 2 my ($self, $body) = @_;
147  
148 2 my $data = Twilio::Serialize::json_body($body, {});
149  
150 my $response = $self->{version}->handle_request(
151 'PATCH',
152 $self->{uri},
153 2 'patch',
154 {
155 data => $data,
156 headers => { 'Content-Type' => 'application/json', }
157 }
158 );
159 2 my $status = $response->get_status_code;
160 return Twilio::Rest::Memory::V1::CreateProfileIdentifier308ResponseInstance->new($self->{version},
161 2 ▶ $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 308 1 1 2
162 if $status == 308;
163 return Twilio::Rest::Memory::V1::PatchProfileIdentifier202ResponseInstance->new($self->{version},
164 1 $response->get_content);
165 }
166  
167 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
168 1 my ($self, $response) = @_;
169 return Twilio::Rest::Memory::V1::IdentifierInstance->new(
170 $self->{version}, $response->get_content, $self->{solution}{store_id},
171 $self->{solution}{profile_id}, $self->{solution}{id_type}
172 1 );
173 }
174  
175 package Twilio::Rest::Memory::V1::IdentifierInstance;
176  
177 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
178  
179 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
180  
181 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
182 2 my ($class, $version, $payload, $store_id, $profile_id, $id_type) = @_;
183 2 my $self = $class->SUPER::new($version, $payload);
184 $self->{solution} = {
185 store_id => $store_id,
186 profile_id => $profile_id,
187 id_type => $id_type // $self->{properties}{idType}
188 2 ▶ };
Condition66%2/3
$id_type // $self->{"properties"}{"idType"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$id_type // $self->{"properties"}{"idType"}
$id_type $self->{"properties"}{"idType"}
Truth table66%2/3
A // B
A= $id_typeB= $self->{"properties"}{"idType"}
ABresult
1X1
011
000
189 2 return $self;
190 }
191  
192 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->delete(@arguments);
195 }
196  
197 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
198 0 my ($self, @arguments) = @_;
199 0 return $self->_context->fetch(@arguments);
200 }
201  
202 0 ▶sub patch {
Subroutine patch: not called CC=1 SCAR=6.9
203 0 my ($self, @arguments) = @_;
204 0 return $self->_context->patch(@arguments);
205 }
206  
207 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
208 0 my ($self) = @_;
209 return Twilio::Rest::Memory::V1::IdentifierContext->new(
210 $self->{version}, $self->{solution}{store_id},
211 $self->{solution}{profile_id}, $self->{solution}{id_type}
212 0 );
213 }
214  
215 2 ▶sub id_type { return $_[0]{properties}{idType} }
Subroutine id_type: called CC=1 SCAR=0.0
216 2 ▶sub values { return $_[0]{properties}{values} }
Subroutine values: called CC=1 SCAR=0.0
217  
218 package Twilio::Rest::Memory::V1::CreateProfileIdentifier202ResponseInstance;
219  
220 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
221  
222 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
223  
224 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
225  
226 package Twilio::Rest::Memory::V1::CreateProfileIdentifier308ResponseInstance;
227  
228 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
229  
230 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
231  
232 4 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
233 4 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
234  
235 package Twilio::Rest::Memory::V1::PatchProfileIdentifier202ResponseInstance;
236  
237 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
238  
239 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
240  
241 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
242  
243 package Twilio::Rest::Memory::V1::DeleteProfileIdentifier202ResponseInstance;
244  
245 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
246  
247 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
248  
249 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
250  
251 2 1;
252  
253 __END__
« Twilio/Rest/Messaging/V1/Service.pm ↑ Summary Twilio/Rest/Pricing/V1/Voice.pm »