Twilio/Rest/Memory/V1/Store.pm

filter: Statementstmt 92.3% 108 / 117 Branchbran n/a Conditioncond 85.7% 6 / 7 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 91.6% 44 / 48 Podpod n/a totaltotal 91.4% 161 / 176 CC 4 SCAR 1.8
CC
4
Cov
92%
patch
2.0
stream
2.0
page
2.0
CRAP 1.2
« Twilio/Rest/Verify/V2/Service/Verification.pm ↑ Summary Twilio/Rest/Insights/V2.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Memory::V1::Store;
3  
4 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Memory::V1::StoreList;
10  
11 3 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 7 my ($class, $version) = @_;
17 7 my $self = $class->SUPER::new($version);
18 7 $self->{solution} = {};
19 7 $self->{uri} = '/ControlPlane/Stores';
20 7 return $self;
21 }
22  
23 2 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 2 my ($self, $body) = @_;
25  
26 2 my $data = Twilio::Serialize::json_body($body, {});
27  
28 my $response = $self->{version}->handle_request(
29 'POST',
30 $self->{uri},
31 2 'create',
32 {
33 data => $data,
34 headers => { 'Content-Type' => 'application/json', }
35 }
36 );
37 return Twilio::Rest::Memory::V1::CreateStore202ResponseInstance->new($self->{version},
38 2 $response->get_content);
39 }
40  
41 1 ▶sub read {
Subroutine read: called CC=1 SCAR=0.0
42 1 my ($self, @arguments) = @_;
43 1 return $self->read_records(@arguments);
44 }
45  
46 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
47 0 my ($self, @arguments) = @_;
48 0 return $self->stream_records(@arguments);
49 }
50  
51 2 ▶sub page {
Subroutine page: called CC=2 SCAR=6.9
52 2 my ($self, $options, $page_size, $page_token) = @_;
53 2 ▶ $options //= {};
Condition100%2/2
$options //= {}
l!l
11
MC/DC100%1/1
$options //= {}
$options
Truth table100%2/2
A
A= $options
Aresult
11
00
54  
55 my $params = {
56 orderBy => $options->{order_by},
57 2 pageSize => $page_size,
58 pageToken => $page_token,
59 };
60  
61 2 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
62 2 return $self->_build_page($response);
63 }
64  
65 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
66 0 my ($self, $target_url) = @_;
67 0 my $client = $self->{version}->get_domain->get_client;
68 0 return $self->_build_page($client->request('GET', $target_url));
69 }
70  
71 2 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
72 2 my ($self, $response) = @_;
73 2 return Twilio::Rest::Memory::V1::StorePage->new($self->{version}, $response, $self->{solution});
74 }
75  
76 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
77 4 my ($self, $store_id) = @_;
78 4 return Twilio::Rest::Memory::V1::StoreContext->new($self->{version}, $store_id);
79 }
80  
81 package Twilio::Rest::Memory::V1::StorePage;
82  
83 3 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 2 ▶sub records_key { return 'stores' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 3 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 3 my ($self, $payload) = @_;
89 3 return Twilio::Rest::Memory::V1::StoreInstance->new($self->{version}, $payload);
90 }
91  
92 package Twilio::Rest::Memory::V1::StoreContext;
93  
94 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
99 5 my ($class, $version, $store_id) = @_;
100 5 my $self = $class->SUPER::new($version);
101 5 $self->{solution} = { store_id => $store_id };
102 5 $self->{uri} = join q{}, '/ControlPlane/Stores/', Twilio::Serialize::path_segment($store_id);
103 5 return $self;
104 }
105  
106 2 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
107 2 my ($self) = @_;
108 2 my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
109 return Twilio::Rest::Memory::V1::DeleteStore202ResponseInstance->new($self->{version},
110 2 $response->get_content);
111 }
112  
113 2 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
114 2 my ($self) = @_;
115  
116 2 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
117 2 return $self->_build_instance($response);
118 }
119  
120 1 ▶sub patch {
Subroutine patch: called CC=2 SCAR=7.0
121 1 my ($self, $body, $options) = @_;
122 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
123  
124 1 my $data = Twilio::Serialize::json_body($body, {});
125  
126 my $response = $self->{version}->handle_request(
127 'PATCH',
128 $self->{uri},
129 'patch',
130 {
131 data => $data,
132 headers => {
133 'Content-Type' => 'application/json',
134 'If-Match' => $options->{if_match},
135 }
136 }
137 1 );
138 return Twilio::Rest::Memory::V1::PatchStore202ResponseInstance->new($self->{version},
139 1 $response->get_content);
140 }
141  
142 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
143 2 my ($self, $response) = @_;
144 return Twilio::Rest::Memory::V1::StoreInstance->new($self->{version}, $response->get_content,
145 2 $self->{solution}{store_id});
146 }
147  
148 package Twilio::Rest::Memory::V1::StoreInstance;
149  
150 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
151  
152 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
153  
154 5 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
155 5 my ($class, $version, $payload, $store_id) = @_;
156 5 my $self = $class->SUPER::new($version, $payload);
157 5 ▶ $self->{solution} = { store_id => $store_id // $self->{properties}{id} };
Condition100%3/3
$store_id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
221
MC/DC100%2/2
$store_id // $self->{"properties"}{"id"}
$store_id $self->{"properties"}{"id"}
Truth table100%3/3
A // B
A= $store_idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
158 5 return $self;
159 }
160  
161 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
162 0 my ($self, @arguments) = @_;
163 0 return $self->_context->delete(@arguments);
164 }
165  
166 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
167 1 my ($self, @arguments) = @_;
168 1 return $self->_context->fetch(@arguments);
169 }
170  
171 0 ▶sub patch {
Subroutine patch: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->patch(@arguments);
174 }
175  
176 1 ▶sub _context {
Subroutine _context: called CC=1 SCAR=0.0
177 1 my ($self) = @_;
178 1 return Twilio::Rest::Memory::V1::StoreContext->new($self->{version}, $self->{solution}{store_id});
179 }
180  
181 1 ▶sub data_as_of { return Twilio::Deserialize::date_time($_[0]{properties}{dataAsOf}) }
Subroutine data_as_of: called CC=1 SCAR=0.0
182 1 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
183 2 ▶sub display_name { return $_[0]{properties}{displayName} }
Subroutine display_name: called CC=1 SCAR=0.0
184 3 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
185 1 ▶sub intelligence_service_id { return $_[0]{properties}{intelligenceServiceId} }
Subroutine intelligence_service_id: called CC=1 SCAR=0.0
186 1 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
187 1 ▶sub version { return $_[0]{properties}{version} }
Subroutine version: called CC=1 SCAR=0.0
188  
189 package Twilio::Rest::Memory::V1::CreateStore202ResponseInstance;
190  
191 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
192  
193 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
194  
195 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
196 2 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
197  
198 package Twilio::Rest::Memory::V1::PatchStore202ResponseInstance;
199  
200 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
201  
202 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
203  
204 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
205 1 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
206  
207 package Twilio::Rest::Memory::V1::DeleteStore202ResponseInstance;
208  
209 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
210  
211 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
212  
213 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
214 1 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
215  
216 3 1;
217  
218 __END__
« Twilio/Rest/Verify/V2/Service/Verification.pm ↑ Summary Twilio/Rest/Insights/V2.pm »