Twilio/Rest/Sync/V1/Service.pm

filter: Statementstmt 81.6% 102 / 125 Branchbran 100% 8 / 8 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 78.4% 40 / 51 Podpod n/a totaltotal 78.2% 155 / 198 CC 9 SCAR 3.8
CC
9
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.5
« Twilio/Rest/Conversations/V1/Service/Conversation.pm ↑ Summary Twilio/Rest/FlexApi/V1/InsightsQuestionnairesCategory.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Sync::V1::Service;
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::Sync::V1::ServiceList;
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 49 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 49 my ($class, $version) = @_;
17 49 my $self = $class->SUPER::new($version);
18 49 $self->{solution} = {};
19 49 $self->{uri} = '/Services';
20 49 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 AclEnabled => Twilio::Serialize::boolean_to_string($options->{acl_enabled}),
29 FriendlyName => $options->{friendly_name},
30 ReachabilityDebouncingEnabled =>
31 Twilio::Serialize::boolean_to_string($options->{reachability_debouncing_enabled}),
32 ReachabilityDebouncingWindow => $options->{reachability_debouncing_window},
33 ReachabilityWebhooksEnabled =>
34 Twilio::Serialize::boolean_to_string($options->{reachability_webhooks_enabled}),
35 WebhookUrl => $options->{webhook_url},
36 WebhooksFromRestEnabled =>
37 1 Twilio::Serialize::boolean_to_string($options->{webhooks_from_rest_enabled}),
38 };
39  
40 my $response =
41 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
42 1 return Twilio::Rest::Sync::V1::ServiceInstance->new($self->{version}, $response->get_content);
43 }
44  
45 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->read_records(@arguments);
48 }
49  
50 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
51 0 my ($self, @arguments) = @_;
52 0 return $self->stream_records(@arguments);
53 }
54  
55 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
56 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
57 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
58  
59 1 my $params = {
60 PageToken => $page_token,
61 Page => $page_number,
62 PageSize => $page_size,
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 1 return Twilio::Rest::Sync::V1::ServicePage->new($self->{version}, $response, $self->{solution});
78 }
79  
80 47 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
81 47 my ($self, $sid) = @_;
82 47 return Twilio::Rest::Sync::V1::ServiceContext->new($self->{version}, $sid);
83 }
84  
85 package Twilio::Rest::Sync::V1::ServicePage;
86  
87 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
88  
89 1 ▶sub records_key { return 'services' }
Subroutine records_key: called CC=1 SCAR=0.0
90  
91 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
92 1 my ($self, $payload) = @_;
93 1 return Twilio::Rest::Sync::V1::ServiceInstance->new($self->{version}, $payload);
94 }
95  
96 package Twilio::Rest::Sync::V1::ServiceContext;
97  
98 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 47 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
103 47 my ($class, $version, $sid) = @_;
104 47 my $self = $class->SUPER::new($version);
105 47 $self->{solution} = { sid => $sid };
106 47 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
107 47 return $self;
108 }
109  
110 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
111 1 my ($self) = @_;
112 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
113 1 return 1;
114 }
115  
116 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
117 1 my ($self) = @_;
118  
119 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
120 1 return $self->_build_instance($response);
121 }
122  
123 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
124 1 my ($self, $options) = @_;
125 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
126  
127 my $data = {
128 AclEnabled => Twilio::Serialize::boolean_to_string($options->{acl_enabled}),
129 FriendlyName => $options->{friendly_name},
130 ReachabilityDebouncingEnabled =>
131 Twilio::Serialize::boolean_to_string($options->{reachability_debouncing_enabled}),
132 ReachabilityDebouncingWindow => $options->{reachability_debouncing_window},
133 ReachabilityWebhooksEnabled =>
134 Twilio::Serialize::boolean_to_string($options->{reachability_webhooks_enabled}),
135 WebhookUrl => $options->{webhook_url},
136 WebhooksFromRestEnabled =>
137 1 Twilio::Serialize::boolean_to_string($options->{webhooks_from_rest_enabled}),
138 };
139  
140 my $response =
141 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
142 1 return $self->_build_instance($response);
143 }
144  
145 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
146 2 my ($self, $response) = @_;
147 return Twilio::Rest::Sync::V1::ServiceInstance->new($self->{version}, $response->get_content,
148 2 $self->{solution}{sid});
149 }
150  
151 9 ▶sub documents {
Subroutine documents: called CC=2 SCAR=6.9
152 9 my ($self, $sid) = @_;
153 9 require Twilio::Rest::Sync::V1::Service::Document;
154 my $list =
155 9 Twilio::Rest::Sync::V1::Service::DocumentList->new($self->{version}, $self->{solution}{sid});
156 9 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 7 2 9
157 }
158  
159 15 ▶sub sync_lists {
Subroutine sync_lists: called CC=2 SCAR=6.9
160 15 my ($self, $sid) = @_;
161 15 require Twilio::Rest::Sync::V1::Service::SyncList;
162 my $list =
163 15 Twilio::Rest::Sync::V1::Service::SyncListList->new($self->{version}, $self->{solution}{sid});
164 15 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 13 2 15
165 }
166  
167 14 ▶sub sync_maps {
Subroutine sync_maps: called CC=2 SCAR=6.9
168 14 my ($self, $sid) = @_;
169 14 require Twilio::Rest::Sync::V1::Service::SyncMap;
170 my $list =
171 14 Twilio::Rest::Sync::V1::Service::SyncMapList->new($self->{version}, $self->{solution}{sid});
172 14 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 12 2 14
173 }
174  
175 6 ▶sub sync_streams {
Subroutine sync_streams: called CC=2 SCAR=6.9
176 6 my ($self, $sid) = @_;
177 6 require Twilio::Rest::Sync::V1::Service::SyncStream;
178 my $list =
179 6 Twilio::Rest::Sync::V1::Service::SyncStreamList->new($self->{version}, $self->{solution}{sid});
180 6 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 4 2 6
181 }
182  
183 package Twilio::Rest::Sync::V1::ServiceInstance;
184  
185 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
186  
187 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
188  
189 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
190 4 my ($class, $version, $payload, $sid) = @_;
191 4 my $self = $class->SUPER::new($version, $payload);
192 4 ▶ $self->{solution} = { 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
193 4 return $self;
194 }
195  
196 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
197 0 my ($self, @arguments) = @_;
198 0 return $self->_context->delete(@arguments);
199 }
200  
201 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
202 0 my ($self, @arguments) = @_;
203 0 return $self->_context->fetch(@arguments);
204 }
205  
206 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
207 0 my ($self, @arguments) = @_;
208 0 return $self->_context->update(@arguments);
209 }
210  
211 0 ▶sub documents {
Subroutine documents: not called CC=1 SCAR=6.9
212 0 my ($self, @arguments) = @_;
213 0 return $self->_context->documents(@arguments);
214 }
215  
216 0 ▶sub sync_lists {
Subroutine sync_lists: not called CC=1 SCAR=6.9
217 0 my ($self, @arguments) = @_;
218 0 return $self->_context->sync_lists(@arguments);
219 }
220  
221 0 ▶sub sync_maps {
Subroutine sync_maps: not called CC=1 SCAR=6.9
222 0 my ($self, @arguments) = @_;
223 0 return $self->_context->sync_maps(@arguments);
224 }
225  
226 0 ▶sub sync_streams {
Subroutine sync_streams: not called CC=1 SCAR=6.9
227 0 my ($self, @arguments) = @_;
228 0 return $self->_context->sync_streams(@arguments);
229 }
230  
231 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
232 0 my ($self) = @_;
233 0 return Twilio::Rest::Sync::V1::ServiceContext->new($self->{version}, $self->{solution}{sid});
234 }
235  
236 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
237 4 ▶sub acl_enabled { return $_[0]{properties}{acl_enabled} }
Subroutine acl_enabled: called CC=1 SCAR=0.0
238 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
239 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
240 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
241 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
242 4 ▶sub reachability_debouncing_enabled { return $_[0]{properties}{reachability_debouncing_enabled} }
Subroutine reachability_debouncing_enabled: called CC=1 SCAR=0.0
243 4 ▶sub reachability_debouncing_window { return $_[0]{properties}{reachability_debouncing_window} }
Subroutine reachability_debouncing_window: called CC=1 SCAR=0.0
244 4 ▶sub reachability_webhooks_enabled { return $_[0]{properties}{reachability_webhooks_enabled} }
Subroutine reachability_webhooks_enabled: called CC=1 SCAR=0.0
245 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
246 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
247 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
248 4 ▶sub webhook_url { return $_[0]{properties}{webhook_url} }
Subroutine webhook_url: called CC=1 SCAR=0.0
249 4 ▶sub webhooks_from_rest_enabled { return $_[0]{properties}{webhooks_from_rest_enabled} }
Subroutine webhooks_from_rest_enabled: called CC=1 SCAR=0.0
250  
251 3 1;
252  
253 __END__
« Twilio/Rest/Conversations/V1/Service/Conversation.pm ↑ Summary Twilio/Rest/FlexApi/V1/InsightsQuestionnairesCategory.pm »