Twilio/Rest/Memory/V1/DataMapping.pm

filter: Statementstmt 87.3% 104 / 119 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 86.0% 43 / 50 Podpod n/a totaltotal 83.8% 151 / 180 CC 4 SCAR 2.2
CC
4
Cov
86%
page
2.0
patch
2.0
new
2.0
CRAP 1.2
« Twilio/Rest/Verify/V2/VerificationAttempt.pm ↑ Summary Twilio/Rest/Bulkexports/V1/ExportConfiguration.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Memory::V1::DataMapping;
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::DataMappingList;
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, $store_id) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { store_id => $store_id };
19 5 $self->{uri} = join q{}, '/ControlPlane/Stores/', Twilio::Serialize::path_segment($store_id),
20 '/DataMappings';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
25 1 my ($self, $body) = @_;
26  
27 1 my $data = Twilio::Serialize::json_body($body, { 'isEnabled' => 'boolean' });
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 1 'create',
33 {
34 data => $data,
35 headers => { 'Content-Type' => 'application/json', }
36 }
37 );
38 return Twilio::Rest::Memory::V1::CreateDataMapping202ResponseInstance->new($self->{version},
39 1 $response->get_content);
40 }
41  
42 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
43 0 my ($self, @arguments) = @_;
44 0 return $self->read_records(@arguments);
45 }
46  
47 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->stream_records(@arguments);
50 }
51  
52 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
53 1 my ($self, $options, $page_size, $page_token) = @_;
54 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
55  
56 my $params = {
57 orderBy => $options->{order_by},
58 type => $options->{type},
59 1 pageSize => $page_size,
60 pageToken => $page_token,
61 };
62  
63 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
64 1 return $self->_build_page($response);
65 }
66  
67 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
68 0 my ($self, $target_url) = @_;
69 0 my $client = $self->{version}->get_domain->get_client;
70 0 return $self->_build_page($client->request('GET', $target_url));
71 }
72  
73 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
74 1 my ($self, $response) = @_;
75 return Twilio::Rest::Memory::V1::DataMappingPage->new($self->{version}, $response,
76 1 $self->{solution});
77 }
78  
79 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
80 3 my ($self, $data_mapping_id) = @_;
81 return Twilio::Rest::Memory::V1::DataMappingContext->new($self->{version},
82 $self->{solution}{store_id},
83 3 $data_mapping_id);
84 }
85  
86 package Twilio::Rest::Memory::V1::DataMappingPage;
87  
88 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 1 ▶sub records_key { return 'dataMappings' }
Subroutine records_key: called CC=1 SCAR=0.0
91  
92 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
93 1 my ($self, $payload) = @_;
94 return Twilio::Rest::Memory::V1::DataMappingInstance->new($self->{version}, $payload,
95 1 $self->{solution}{store_id});
96 }
97  
98 package Twilio::Rest::Memory::V1::DataMappingContext;
99  
100 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
105 3 my ($class, $version, $store_id, $data_mapping_id) = @_;
106 3 my $self = $class->SUPER::new($version);
107 3 $self->{solution} = { store_id => $store_id, data_mapping_id => $data_mapping_id };
108 3 $self->{uri} = join q{}, '/ControlPlane/Stores/', Twilio::Serialize::path_segment($store_id),
109 '/DataMappings/', Twilio::Serialize::path_segment($data_mapping_id);
110 3 return $self;
111 }
112  
113 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
114 1 my ($self) = @_;
115 1 my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
116 return Twilio::Rest::Memory::V1::DeleteDataMapping202ResponseInstance->new($self->{version},
117 1 $response->get_content);
118 }
119  
120 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
121 1 my ($self) = @_;
122  
123 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
124 1 return $self->_build_instance($response);
125 }
126  
127 1 ▶sub patch {
Subroutine patch: called CC=2 SCAR=7.0
128 1 my ($self, $body, $options) = @_;
129 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
130  
131 1 my $data = Twilio::Serialize::json_body($body, {});
132  
133 my $response = $self->{version}->handle_request(
134 'PATCH',
135 $self->{uri},
136 'patch',
137 {
138 data => $data,
139 headers => {
140 'Content-Type' => 'application/json',
141 'If-Match' => $options->{if_match},
142 }
143 }
144 1 );
145 return Twilio::Rest::Memory::V1::PatchDataMapping202ResponseInstance->new($self->{version},
146 1 $response->get_content);
147 }
148  
149 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
150 1 my ($self, $response) = @_;
151 return Twilio::Rest::Memory::V1::DataMappingInstance->new(
152 $self->{version}, $response->get_content,
153 $self->{solution}{store_id},
154 $self->{solution}{data_mapping_id}
155 1 );
156 }
157  
158 package Twilio::Rest::Memory::V1::DataMappingInstance;
159  
160 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
161  
162 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
163  
164 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
165 2 my ($class, $version, $payload, $store_id, $data_mapping_id) = @_;
166 2 my $self = $class->SUPER::new($version, $payload);
167 $self->{solution} =
168 2 ▶ { store_id => $store_id, data_mapping_id => $data_mapping_id // $self->{properties}{id} };
Condition66%2/3
$data_mapping_id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$data_mapping_id // $self->{"properties"}{"id"}
$data_mapping_id $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $data_mapping_idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
169 2 return $self;
170 }
171  
172 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
173 0 my ($self, @arguments) = @_;
174 0 return $self->_context->delete(@arguments);
175 }
176  
177 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->fetch(@arguments);
180 }
181  
182 0 ▶sub patch {
Subroutine patch: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->patch(@arguments);
185 }
186  
187 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
188 0 my ($self) = @_;
189 return Twilio::Rest::Memory::V1::DataMappingContext->new(
190 $self->{version},
191 $self->{solution}{store_id},
192 $self->{solution}{data_mapping_id}
193 0 );
194 }
195  
196 2 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
197 2 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
198 2 ▶sub display_name { return $_[0]{properties}{displayName} }
Subroutine display_name: called CC=1 SCAR=0.0
199 2 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
200 2 ▶sub is_enabled { return $_[0]{properties}{isEnabled} }
Subroutine is_enabled: called CC=1 SCAR=0.0
201 2 ▶sub mapping_from { return $_[0]{properties}{mappingFrom} }
Subroutine mapping_from: called CC=1 SCAR=0.0
202 2 ▶sub mapping_to { return $_[0]{properties}{mappingTo} }
Subroutine mapping_to: called CC=1 SCAR=0.0
203 2 ▶sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) }
Subroutine updated_at: called CC=1 SCAR=0.0
204 2 ▶sub version { return $_[0]{properties}{version} }
Subroutine version: called CC=1 SCAR=0.0
205  
206 package Twilio::Rest::Memory::V1::CreateDataMapping202ResponseInstance;
207  
208 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
209  
210 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
211  
212 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
213 1 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
214  
215 package Twilio::Rest::Memory::V1::PatchDataMapping202ResponseInstance;
216  
217 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
218  
219 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
220  
221 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
222 1 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
223  
224 package Twilio::Rest::Memory::V1::DeleteDataMapping202ResponseInstance;
225  
226 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
227  
228 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
229  
230 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
231 1 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
232  
233 2 1;
234  
235 __END__
« Twilio/Rest/Verify/V2/VerificationAttempt.pm ↑ Summary Twilio/Rest/Bulkexports/V1/ExportConfiguration.pm »