Twilio/Rest/Messaging/V1/Service.pm

filter: Statementstmt 80.7% 122 / 151 Branchbran 100% 12 / 12 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 78.7% 52 / 66 Podpod n/a totaltotal 78.6% 191 / 243 CC 11 SCAR 3.7
CC
11
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Api/V2010/Account/Call.pm ↑ Summary Twilio/Rest/Memory/V1/Identifier.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Messaging::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::Messaging::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 34 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 34 my ($class, $version) = @_;
17 34 my $self = $class->SUPER::new($version);
18 34 $self->{solution} = {};
19 34 $self->{uri} = '/Services';
20 34 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $friendly_name, $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 FriendlyName => $friendly_name,
29 AreaCodeGeomatch => Twilio::Serialize::boolean_to_string($options->{area_code_geomatch}),
30 FallbackMethod => $options->{fallback_method},
31 FallbackToLongCode => Twilio::Serialize::boolean_to_string($options->{fallback_to_long_code}),
32 FallbackUrl => $options->{fallback_url},
33 InboundMethod => $options->{inbound_method},
34 InboundRequestUrl => $options->{inbound_request_url},
35 MmsConverter => Twilio::Serialize::boolean_to_string($options->{mms_converter}),
36 ScanMessageContent => $options->{scan_message_content},
37 SmartEncoding => Twilio::Serialize::boolean_to_string($options->{smart_encoding}),
38 StatusCallback => $options->{status_callback},
39 StickySender => Twilio::Serialize::boolean_to_string($options->{sticky_sender}),
40 SynchronousValidation =>
41 Twilio::Serialize::boolean_to_string($options->{synchronous_validation}),
42 UseInboundWebhookOnNumber =>
43 Twilio::Serialize::boolean_to_string($options->{use_inbound_webhook_on_number}),
44 Usecase => $options->{usecase},
45 ValidityPeriod => $options->{validity_period},
46 1 };
47  
48 my $response =
49 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
50 return Twilio::Rest::Messaging::V1::ServiceInstance->new($self->{version},
51 1 $response->get_content);
52 }
53  
54 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
55 0 my ($self, @arguments) = @_;
56 0 return $self->read_records(@arguments);
57 }
58  
59 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
60 0 my ($self, @arguments) = @_;
61 0 return $self->stream_records(@arguments);
62 }
63  
64 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
65 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
66 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
67  
68 1 my $params = {
69 PageToken => $page_token,
70 Page => $page_number,
71 PageSize => $page_size,
72 };
73  
74 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
75 1 return $self->_build_page($response);
76 }
77  
78 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
79 0 my ($self, $target_url) = @_;
80 0 my $client = $self->{version}->get_domain->get_client;
81 0 return $self->_build_page($client->request('GET', $target_url));
82 }
83  
84 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
85 1 my ($self, $response) = @_;
86 return Twilio::Rest::Messaging::V1::ServicePage->new($self->{version}, $response,
87 1 $self->{solution});
88 }
89  
90 32 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
91 32 my ($self, $sid) = @_;
92 32 return Twilio::Rest::Messaging::V1::ServiceContext->new($self->{version}, $sid);
93 }
94  
95 package Twilio::Rest::Messaging::V1::ServicePage;
96  
97 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 1 ▶sub records_key { return 'services' }
Subroutine records_key: called CC=1 SCAR=0.0
100  
101 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
102 1 my ($self, $payload) = @_;
103 1 return Twilio::Rest::Messaging::V1::ServiceInstance->new($self->{version}, $payload);
104 }
105  
106 package Twilio::Rest::Messaging::V1::ServiceContext;
107  
108 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
109  
110 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
111  
112 32 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
113 32 my ($class, $version, $sid) = @_;
114 32 my $self = $class->SUPER::new($version);
115 32 $self->{solution} = { sid => $sid };
116 32 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
117 32 return $self;
118 }
119  
120 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
121 1 my ($self) = @_;
122 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
123 1 return 1;
124 }
125  
126 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
127 1 my ($self) = @_;
128  
129 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
130 1 return $self->_build_instance($response);
131 }
132  
133 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
134 1 my ($self, $options) = @_;
135 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
136  
137 my $data = {
138 AreaCodeGeomatch => Twilio::Serialize::boolean_to_string($options->{area_code_geomatch}),
139 FallbackMethod => $options->{fallback_method},
140 FallbackToLongCode => Twilio::Serialize::boolean_to_string($options->{fallback_to_long_code}),
141 FallbackUrl => $options->{fallback_url},
142 FriendlyName => $options->{friendly_name},
143 InboundMethod => $options->{inbound_method},
144 InboundRequestUrl => $options->{inbound_request_url},
145 MmsConverter => Twilio::Serialize::boolean_to_string($options->{mms_converter}),
146 ScanMessageContent => $options->{scan_message_content},
147 SmartEncoding => Twilio::Serialize::boolean_to_string($options->{smart_encoding}),
148 StatusCallback => $options->{status_callback},
149 StickySender => Twilio::Serialize::boolean_to_string($options->{sticky_sender}),
150 SynchronousValidation =>
151 Twilio::Serialize::boolean_to_string($options->{synchronous_validation}),
152 UseInboundWebhookOnNumber =>
153 Twilio::Serialize::boolean_to_string($options->{use_inbound_webhook_on_number}),
154 Usecase => $options->{usecase},
155 ValidityPeriod => $options->{validity_period},
156 1 };
157  
158 my $response =
159 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
160 1 return $self->_build_instance($response);
161 }
162  
163 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
164 2 my ($self, $response) = @_;
165 return Twilio::Rest::Messaging::V1::ServiceInstance->new($self->{version},
166 2 $response->get_content, $self->{solution}{sid});
167 }
168  
169 4 ▶sub alpha_senders {
Subroutine alpha_senders: called CC=2 SCAR=6.9
170 4 my ($self, $sid) = @_;
171 4 require Twilio::Rest::Messaging::V1::Service::AlphaSender;
172 my $list = Twilio::Rest::Messaging::V1::Service::AlphaSenderList->new($self->{version},
173 4 $self->{solution}{sid});
174 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
175 }
176  
177 4 ▶sub channel_senders {
Subroutine channel_senders: called CC=2 SCAR=6.9
178 4 my ($self, $sid) = @_;
179 4 require Twilio::Rest::Messaging::V1::Service::ChannelSender;
180 my $list = Twilio::Rest::Messaging::V1::Service::ChannelSenderList->new($self->{version},
181 4 $self->{solution}{sid});
182 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
183 }
184  
185 4 ▶sub destination_alpha_senders {
Subroutine destination_alpha_senders: called CC=2 SCAR=6.9
186 4 my ($self, $sid) = @_;
187 4 require Twilio::Rest::Messaging::V1::Service::DestinationAlphaSender;
188 my $list = Twilio::Rest::Messaging::V1::Service::DestinationAlphaSenderList->new($self->{version},
189 4 $self->{solution}{sid});
190 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
191 }
192  
193 5 ▶sub phone_numbers {
Subroutine phone_numbers: called CC=2 SCAR=6.9
194 5 my ($self, $sid) = @_;
195 5 require Twilio::Rest::Messaging::V1::Service::PhoneNumber;
196 my $list = Twilio::Rest::Messaging::V1::Service::PhoneNumberList->new($self->{version},
197 5 $self->{solution}{sid});
198 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 3 5
199 }
200  
201 5 ▶sub short_codes {
Subroutine short_codes: called CC=2 SCAR=6.9
202 5 my ($self, $sid) = @_;
203 5 require Twilio::Rest::Messaging::V1::Service::ShortCode;
204 my $list = Twilio::Rest::Messaging::V1::Service::ShortCodeList->new($self->{version},
205 5 $self->{solution}{sid});
206 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 3 5
207 }
208  
209 6 ▶sub us_app_to_person {
Subroutine us_app_to_person: called CC=2 SCAR=6.9
210 6 my ($self, $sid) = @_;
211 6 require Twilio::Rest::Messaging::V1::Service::UsAppToPerson;
212 my $list = Twilio::Rest::Messaging::V1::Service::UsAppToPersonList->new($self->{version},
213 6 $self->{solution}{sid});
214 6 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 4 2 6
215 }
216  
217 1 ▶sub us_app_to_person_usecases {
Subroutine us_app_to_person_usecases: called CC=1 SCAR=0.0
218 1 my ($self) = @_;
219 1 require Twilio::Rest::Messaging::V1::Service::UsAppToPersonUsecase;
220 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonUsecaseList->new($self->{version},
221 1 $self->{solution}{sid});
222 }
223  
224 package Twilio::Rest::Messaging::V1::ServiceInstance;
225  
226 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
227  
228 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
229  
230 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
231 4 my ($class, $version, $payload, $sid) = @_;
232 4 my $self = $class->SUPER::new($version, $payload);
233 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
234 4 return $self;
235 }
236  
237 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
238 0 my ($self, @arguments) = @_;
239 0 return $self->_context->delete(@arguments);
240 }
241  
242 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
243 0 my ($self, @arguments) = @_;
244 0 return $self->_context->fetch(@arguments);
245 }
246  
247 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
248 0 my ($self, @arguments) = @_;
249 0 return $self->_context->update(@arguments);
250 }
251  
252 0 ▶sub alpha_senders {
Subroutine alpha_senders: not called CC=1 SCAR=6.9
253 0 my ($self, @arguments) = @_;
254 0 return $self->_context->alpha_senders(@arguments);
255 }
256  
257 0 ▶sub channel_senders {
Subroutine channel_senders: not called CC=1 SCAR=6.9
258 0 my ($self, @arguments) = @_;
259 0 return $self->_context->channel_senders(@arguments);
260 }
261  
262 0 ▶sub destination_alpha_senders {
Subroutine destination_alpha_senders: not called CC=1 SCAR=6.9
263 0 my ($self, @arguments) = @_;
264 0 return $self->_context->destination_alpha_senders(@arguments);
265 }
266  
267 0 ▶sub phone_numbers {
Subroutine phone_numbers: not called CC=1 SCAR=6.9
268 0 my ($self, @arguments) = @_;
269 0 return $self->_context->phone_numbers(@arguments);
270 }
271  
272 0 ▶sub short_codes {
Subroutine short_codes: not called CC=1 SCAR=6.9
273 0 my ($self, @arguments) = @_;
274 0 return $self->_context->short_codes(@arguments);
275 }
276  
277 0 ▶sub us_app_to_person {
Subroutine us_app_to_person: not called CC=1 SCAR=6.9
278 0 my ($self, @arguments) = @_;
279 0 return $self->_context->us_app_to_person(@arguments);
280 }
281  
282 0 ▶sub us_app_to_person_usecases {
Subroutine us_app_to_person_usecases: not called CC=1 SCAR=6.9
283 0 my ($self, @arguments) = @_;
284 0 return $self->_context->us_app_to_person_usecases(@arguments);
285 }
286  
287 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
288 0 my ($self) = @_;
289 0 return Twilio::Rest::Messaging::V1::ServiceContext->new($self->{version}, $self->{solution}{sid});
290 }
291  
292 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
293 4 ▶sub area_code_geomatch { return $_[0]{properties}{area_code_geomatch} }
Subroutine area_code_geomatch: called CC=1 SCAR=0.0
294 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
295 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
296 4 ▶sub fallback_method { return $_[0]{properties}{fallback_method} }
Subroutine fallback_method: called CC=1 SCAR=0.0
297 4 ▶sub fallback_to_long_code { return $_[0]{properties}{fallback_to_long_code} }
Subroutine fallback_to_long_code: called CC=1 SCAR=0.0
298 4 ▶sub fallback_url { return $_[0]{properties}{fallback_url} }
Subroutine fallback_url: called CC=1 SCAR=0.0
299 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
300 4 ▶sub inbound_method { return $_[0]{properties}{inbound_method} }
Subroutine inbound_method: called CC=1 SCAR=0.0
301 4 ▶sub inbound_request_url { return $_[0]{properties}{inbound_request_url} }
Subroutine inbound_request_url: called CC=1 SCAR=0.0
302 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
303 4 ▶sub mms_converter { return $_[0]{properties}{mms_converter} }
Subroutine mms_converter: called CC=1 SCAR=0.0
304 4 ▶sub scan_message_content { return $_[0]{properties}{scan_message_content} }
Subroutine scan_message_content: called CC=1 SCAR=0.0
305 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
306 4 ▶sub smart_encoding { return $_[0]{properties}{smart_encoding} }
Subroutine smart_encoding: called CC=1 SCAR=0.0
307 4 ▶sub status_callback { return $_[0]{properties}{status_callback} }
Subroutine status_callback: called CC=1 SCAR=0.0
308 4 ▶sub sticky_sender { return $_[0]{properties}{sticky_sender} }
Subroutine sticky_sender: called CC=1 SCAR=0.0
309 4 ▶sub synchronous_validation { return $_[0]{properties}{synchronous_validation} }
Subroutine synchronous_validation: called CC=1 SCAR=0.0
310 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
311 4 ▶sub us_app_to_person_registered { return $_[0]{properties}{us_app_to_person_registered} }
Subroutine us_app_to_person_registered: called CC=1 SCAR=0.0
312 4 ▶sub use_inbound_webhook_on_number { return $_[0]{properties}{use_inbound_webhook_on_number} }
Subroutine use_inbound_webhook_on_number: called CC=1 SCAR=0.0
313 4 ▶sub usecase { return $_[0]{properties}{usecase} }
Subroutine usecase: called CC=1 SCAR=0.0
314 4 ▶sub validity_period { return $_[0]{properties}{validity_period} }
Subroutine validity_period: called CC=1 SCAR=0.0
315  
316 3 1;
317  
318 __END__
« Twilio/Rest/Api/V2010/Account/Call.pm ↑ Summary Twilio/Rest/Memory/V1/Identifier.pm »