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

filter: Statementstmt 82.7% 91 / 110 Branchbran 100% 4 / 4 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 79.5% 35 / 44 Podpod n/a totaltotal 78.4% 135 / 172 CC 7 SCAR 3.5
CC
7
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Sync/V1/Service/SyncList.pm ↑ Summary Twilio/Rest/FlexApi/V1/Plugin.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;
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::SyncMapList;
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 14 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 14 my ($class, $version, $service_sid) = @_;
17 14 my $self = $class->SUPER::new($version);
18 14 $self->{solution} = { service_sid => $service_sid };
19 14 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Maps';
20 14 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $options) = @_;
25 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
26  
27 my $data = {
28 CollectionTtl => $options->{collection_ttl},
29 Ttl => $options->{ttl},
30 UniqueName => $options->{unique_name},
31 1 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Sync::V1::Service::SyncMapInstance->new($self->{version},
36 1 $response->get_content, $self->{solution}{service_sid});
37 }
38  
39 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->read_records(@arguments);
42 }
43  
44 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
45 0 my ($self, @arguments) = @_;
46 0 return $self->stream_records(@arguments);
47 }
48  
49 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
50 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
51 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
52  
53 1 my $params = {
54 PageToken => $page_token,
55 Page => $page_number,
56 PageSize => $page_size,
57 };
58  
59 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
60 1 return $self->_build_page($response);
61 }
62  
63 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
64 0 my ($self, $target_url) = @_;
65 0 my $client = $self->{version}->get_domain->get_client;
66 0 return $self->_build_page($client->request('GET', $target_url));
67 }
68  
69 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
70 1 my ($self, $response) = @_;
71 return Twilio::Rest::Sync::V1::Service::SyncMapPage->new($self->{version}, $response,
72 1 $self->{solution});
73 }
74  
75 12 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
76 12 my ($self, $sid) = @_;
77 return Twilio::Rest::Sync::V1::Service::SyncMapContext->new($self->{version},
78 12 $self->{solution}{service_sid}, $sid);
79 }
80  
81 package Twilio::Rest::Sync::V1::Service::SyncMapPage;
82  
83 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 1 ▶sub records_key { return 'maps' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 1 my ($self, $payload) = @_;
89 return Twilio::Rest::Sync::V1::Service::SyncMapInstance->new($self->{version}, $payload,
90 1 $self->{solution}{service_sid});
91 }
92  
93 package Twilio::Rest::Sync::V1::Service::SyncMapContext;
94  
95 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 12 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
100 12 my ($class, $version, $service_sid, $sid) = @_;
101 12 my $self = $class->SUPER::new($version);
102 12 $self->{solution} = { service_sid => $service_sid, sid => $sid };
103 12 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Maps/',
104 Twilio::Serialize::path_segment($sid);
105 12 return $self;
106 }
107  
108 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
109 1 my ($self) = @_;
110 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
111 1 return 1;
112 }
113  
114 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
115 1 my ($self) = @_;
116  
117 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
118 1 return $self->_build_instance($response);
119 }
120  
121 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
122 1 my ($self, $options) = @_;
123 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
124  
125 my $data = {
126 CollectionTtl => $options->{collection_ttl},
127 Ttl => $options->{ttl},
128 1 };
129  
130 my $response =
131 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
132 1 return $self->_build_instance($response);
133 }
134  
135 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
136 2 my ($self, $response) = @_;
137 return Twilio::Rest::Sync::V1::Service::SyncMapInstance->new(
138 $self->{version}, $response->get_content,
139 $self->{solution}{service_sid}, $self->{solution}{sid}
140 2 );
141 }
142  
143 5 ▶sub sync_map_items {
Subroutine sync_map_items: called CC=2 SCAR=6.9
144 5 my ($self, $key) = @_;
145 5 require Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItem;
146 my $list = Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapItemList->new(
147 $self->{version},
148 $self->{solution}{service_sid},
149 $self->{solution}{sid}
150 5 );
151 5 ▶ return defined $key ? $list->get_context($key) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $key ? : 3 2 5
152 }
153  
154 4 ▶sub sync_map_permissions {
Subroutine sync_map_permissions: called CC=2 SCAR=6.9
155 4 my ($self, $identity) = @_;
156 4 require Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapPermission;
157 my $list = Twilio::Rest::Sync::V1::Service::SyncMap::SyncMapPermissionList->new(
158 $self->{version},
159 $self->{solution}{service_sid},
160 $self->{solution}{sid}
161 4 );
162 4 ▶ return defined $identity ? $list->get_context($identity) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $identity ? : 3 1 4
163 }
164  
165 package Twilio::Rest::Sync::V1::Service::SyncMapInstance;
166  
167 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
168  
169 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
170  
171 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
172 4 my ($class, $version, $payload, $service_sid, $sid) = @_;
173 4 my $self = $class->SUPER::new($version, $payload);
174 4 ▶ $self->{solution} = { service_sid => $service_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
220
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
175 4 return $self;
176 }
177  
178 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
179 0 my ($self, @arguments) = @_;
180 0 return $self->_context->delete(@arguments);
181 }
182  
183 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
184 0 my ($self, @arguments) = @_;
185 0 return $self->_context->fetch(@arguments);
186 }
187  
188 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
189 0 my ($self, @arguments) = @_;
190 0 return $self->_context->update(@arguments);
191 }
192  
193 0 ▶sub sync_map_items {
Subroutine sync_map_items: not called CC=1 SCAR=6.9
194 0 my ($self, @arguments) = @_;
195 0 return $self->_context->sync_map_items(@arguments);
196 }
197  
198 0 ▶sub sync_map_permissions {
Subroutine sync_map_permissions: not called CC=1 SCAR=6.9
199 0 my ($self, @arguments) = @_;
200 0 return $self->_context->sync_map_permissions(@arguments);
201 }
202  
203 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
204 0 my ($self) = @_;
205 return Twilio::Rest::Sync::V1::Service::SyncMapContext->new(
206 $self->{version},
207 $self->{solution}{service_sid},
208 $self->{solution}{sid}
209 0 );
210 }
211  
212 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
213 4 ▶sub created_by { return $_[0]{properties}{created_by} }
Subroutine created_by: called CC=1 SCAR=0.0
214 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
215 4 ▶sub date_expires { return Twilio::Deserialize::date_time($_[0]{properties}{date_expires}) }
Subroutine date_expires: called CC=1 SCAR=0.0
216 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
217 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
218 4 ▶sub revision { return $_[0]{properties}{revision} }
Subroutine revision: called CC=1 SCAR=0.0
219 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
220 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
221 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
222 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
223  
224 2 1;
225  
226 __END__
« Twilio/Rest/Sync/V1/Service/SyncList.pm ↑ Summary Twilio/Rest/FlexApi/V1/Plugin.pm »