Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItem.pm

filter: Statementstmt 84.8% 84 / 99 Branchbran n/a Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 82.5% 33 / 40 Podpod n/a totaltotal 78.8% 123 / 156 CC 6 SCAR 3.2
CC
6
Cov
82%
delete
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Api/V2010/Account/SigningKey.pm ↑ Summary Twilio/Rest/Events/V1/Subscription.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItem;
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::Sync::V1::Service::SyncMap::SyncMapItemList;
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, $service_sid, $map_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { service_sid => $service_sid, map_sid => $map_sid };
19 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Maps/',
20 Twilio::Serialize::path_segment($map_sid), '/Items';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $key, $data_value, $options) = @_;
26 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
27  
28 my $data = {
29 Key => $key,
30 Data => Twilio::Serialize::json_object($data_value),
31 CollectionTtl => $options->{collection_ttl},
32 ItemTtl => $options->{item_ttl},
33 Ttl => $options->{ttl},
34 1 };
35  
36 my $response =
37 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
38 return Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemInstance->new(
39 $self->{version}, $response->get_content,
40 $self->{solution}{service_sid}, $self->{solution}{map_sid}
41 1 );
42 }
43  
44 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
45 0 my ($self, @arguments) = @_;
46 0 return $self->read_records(@arguments);
47 }
48  
49 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
50 0 my ($self, @arguments) = @_;
51 0 return $self->stream_records(@arguments);
52 }
53  
54 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
55 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
56 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
57  
58 my $params = {
59 Bounds => $options->{bounds},
60 From => $options->{from},
61 Order => $options->{order},
62 1 PageToken => $page_token,
63 Page => $page_number,
64 PageSize => $page_size,
65 };
66  
67 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
68 1 return $self->_build_page($response);
69 }
70  
71 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
72 0 my ($self, $target_url) = @_;
73 0 my $client = $self->{version}->get_domain->get_client;
74 0 return $self->_build_page($client->request('GET', $target_url));
75 }
76  
77 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
78 1 my ($self, $response) = @_;
79 return Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemPage->new($self->{version},
80 1 $response, $self->{solution});
81 }
82  
83 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
84 3 my ($self, $key) = @_;
85 return Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemContext->new(
86 $self->{version},
87 $self->{solution}{service_sid},
88 3 $self->{solution}{map_sid}, $key
89 );
90 }
91  
92 package Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemPage;
93  
94 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 1 ▶sub records_key { return 'items' }
Subroutine records_key: called CC=1 SCAR=0.0
97  
98 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
99 1 my ($self, $payload) = @_;
100 return Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemInstance->new(
101 $self->{version}, $payload,
102 $self->{solution}{service_sid},
103 $self->{solution}{map_sid}
104 1 );
105 }
106  
107 package Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemContext;
108  
109 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
110  
111 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
112  
113 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
114 3 my ($class, $version, $service_sid, $map_sid, $key) = @_;
115 3 my $self = $class->SUPER::new($version);
116 3 $self->{solution} = { service_sid => $service_sid, map_sid => $map_sid, key => $key };
117 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Maps/',
118 Twilio::Serialize::path_segment($map_sid), '/Items/', Twilio::Serialize::path_segment($key);
119 3 return $self;
120 }
121  
122 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
123 1 my ($self, $options) = @_;
124 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
125 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
126 1 { headers => { 'If-Match' => $options->{if_match}, } });
127 1 return 1;
128 }
129  
130 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
131 1 my ($self) = @_;
132  
133 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
134 1 return $self->_build_instance($response);
135 }
136  
137 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
138 1 my ($self, $options) = @_;
139 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
140  
141 my $data = {
142 CollectionTtl => $options->{collection_ttl},
143 Data => Twilio::Serialize::json_object($options->{data}),
144 ItemTtl => $options->{item_ttl},
145 Ttl => $options->{ttl},
146 1 };
147  
148 my $response = $self->{version}->handle_request(
149 'POST',
150 $self->{uri},
151 'update',
152 {
153 data => $data,
154 headers => { 'If-Match' => $options->{if_match}, }
155 }
156 1 );
157 1 return $self->_build_instance($response);
158 }
159  
160 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
161 2 my ($self, $response) = @_;
162 return Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemInstance->new(
163 $self->{version}, $response->get_content,
164 $self->{solution}{service_sid},
165 $self->{solution}{map_sid},
166 $self->{solution}{key}
167 2 );
168 }
169  
170 package Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemInstance;
171  
172 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
173  
174 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
175  
176 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
177 4 my ($class, $version, $payload, $service_sid, $map_sid, $key) = @_;
178 4 my $self = $class->SUPER::new($version, $payload);
179 $self->{solution} =
180 4 ▶ { service_sid => $service_sid, map_sid => $map_sid, key => $key // $self->{properties}{key} };
Condition66%2/3
$key // $self->{"properties"}{"key"}
l!l&&r!l&&!r
220
MC/DC0%0/2
$key // $self->{"properties"}{"key"}
$key $self->{"properties"}{"key"}
Truth table66%2/3
A // B
A= $keyB= $self->{"properties"}{"key"}
ABresult
1X1
011
000
181 4 return $self;
182 }
183  
184 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
185 0 my ($self, @arguments) = @_;
186 0 return $self->_context->delete(@arguments);
187 }
188  
189 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
190 0 my ($self, @arguments) = @_;
191 0 return $self->_context->fetch(@arguments);
192 }
193  
194 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
195 0 my ($self, @arguments) = @_;
196 0 return $self->_context->update(@arguments);
197 }
198  
199 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
200 0 my ($self) = @_;
201 return Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemContext->new(
202 $self->{version}, $self->{solution}{service_sid},
203 $self->{solution}{map_sid}, $self->{solution}{key}
204 0 );
205 }
206  
207 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
208 4 ▶sub created_by { return $_[0]{properties}{created_by} }
Subroutine created_by: called CC=1 SCAR=0.0
209 4 ▶sub data { return $_[0]{properties}{data} }
Subroutine data: called CC=1 SCAR=0.0
210 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
211 4 ▶sub date_expires { return Twilio::Deserialize::date_time($_[0]{properties}{date_expires}) }
Subroutine date_expires: called CC=1 SCAR=0.0
212 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
213 4 ▶sub key { return $_[0]{properties}{key} }
Subroutine key: called CC=1 SCAR=0.0
214 4 ▶sub map_sid { return $_[0]{properties}{map_sid} }
Subroutine map_sid: called CC=1 SCAR=0.0
215 4 ▶sub revision { return $_[0]{properties}{revision} }
Subroutine revision: called CC=1 SCAR=0.0
216 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
217 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
218  
219 2 1;
220  
221 __END__
« Twilio/Rest/Api/V2010/Account/SigningKey.pm ↑ Summary Twilio/Rest/Events/V1/Subscription.pm »