Twilio/Rest/Notify/V1/Service.pm

filter: Statementstmt 83.9% 99 / 118 Branchbran 100% 2 / 2 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 83.0% 44 / 53 Podpod n/a totaltotal 80.2% 150 / 187 CC 6 SCAR 2.8
CC
6
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/IpMessaging/V1/Service/Channel/Message.pm ↑ Summary Twilio/Rest/FlexApi/V1/FlexFlow.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Notify::V1::Service;
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::Notify::V1::ServiceList;
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 10 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 10 my ($class, $version) = @_;
17 10 my $self = $class->SUPER::new($version);
18 10 $self->{solution} = {};
19 10 $self->{uri} = '/Services';
20 10 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 AlexaSkillId => $options->{alexa_skill_id},
29 ApnCredentialSid => $options->{apn_credential_sid},
30 DefaultAlexaNotificationProtocolVersion =>
31 $options->{default_alexa_notification_protocol_version},
32 DefaultApnNotificationProtocolVersion => $options->{default_apn_notification_protocol_version},
33 DefaultFcmNotificationProtocolVersion => $options->{default_fcm_notification_protocol_version},
34 DefaultGcmNotificationProtocolVersion => $options->{default_gcm_notification_protocol_version},
35 DeliveryCallbackEnabled =>
36 Twilio::Serialize::boolean_to_string($options->{delivery_callback_enabled}),
37 DeliveryCallbackUrl => $options->{delivery_callback_url},
38 FacebookMessengerPageId => $options->{facebook_messenger_page_id},
39 FcmCredentialSid => $options->{fcm_credential_sid},
40 FriendlyName => $options->{friendly_name},
41 GcmCredentialSid => $options->{gcm_credential_sid},
42 LogEnabled => Twilio::Serialize::boolean_to_string($options->{log_enabled}),
43 MessagingServiceSid => $options->{messaging_service_sid},
44 1 };
45  
46 my $response =
47 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
48 1 return Twilio::Rest::Notify::V1::ServiceInstance->new($self->{version}, $response->get_content);
49 }
50  
51 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
52 0 my ($self, @arguments) = @_;
53 0 return $self->read_records(@arguments);
54 }
55  
56 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
57 0 my ($self, @arguments) = @_;
58 0 return $self->stream_records(@arguments);
59 }
60  
61 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
62 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
63 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
64  
65 my $params = {
66 FriendlyName => $options->{friendly_name},
67 1 PageToken => $page_token,
68 Page => $page_number,
69 PageSize => $page_size,
70 };
71  
72 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
73 1 return $self->_build_page($response);
74 }
75  
76 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
77 0 my ($self, $target_url) = @_;
78 0 my $client = $self->{version}->get_domain->get_client;
79 0 return $self->_build_page($client->request('GET', $target_url));
80 }
81  
82 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
83 1 my ($self, $response) = @_;
84 1 return Twilio::Rest::Notify::V1::ServicePage->new($self->{version}, $response, $self->{solution});
85 }
86  
87 8 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
88 8 my ($self, $sid) = @_;
89 8 return Twilio::Rest::Notify::V1::ServiceContext->new($self->{version}, $sid);
90 }
91  
92 package Twilio::Rest::Notify::V1::ServicePage;
93  
94 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 1 ▶sub records_key { return 'services' }
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 1 return Twilio::Rest::Notify::V1::ServiceInstance->new($self->{version}, $payload);
101 }
102  
103 package Twilio::Rest::Notify::V1::ServiceContext;
104  
105 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
108  
109 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
110 8 my ($class, $version, $sid) = @_;
111 8 my $self = $class->SUPER::new($version);
112 8 $self->{solution} = { sid => $sid };
113 8 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
114 8 return $self;
115 }
116  
117 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
118 1 my ($self) = @_;
119 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
120 1 return 1;
121 }
122  
123 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
124 1 my ($self) = @_;
125  
126 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
127 1 return $self->_build_instance($response);
128 }
129  
130 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
131 1 my ($self, $options) = @_;
132 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
133  
134 my $data = {
135 AlexaSkillId => $options->{alexa_skill_id},
136 ApnCredentialSid => $options->{apn_credential_sid},
137 DefaultAlexaNotificationProtocolVersion =>
138 $options->{default_alexa_notification_protocol_version},
139 DefaultApnNotificationProtocolVersion => $options->{default_apn_notification_protocol_version},
140 DefaultFcmNotificationProtocolVersion => $options->{default_fcm_notification_protocol_version},
141 DefaultGcmNotificationProtocolVersion => $options->{default_gcm_notification_protocol_version},
142 DeliveryCallbackEnabled =>
143 Twilio::Serialize::boolean_to_string($options->{delivery_callback_enabled}),
144 DeliveryCallbackUrl => $options->{delivery_callback_url},
145 FacebookMessengerPageId => $options->{facebook_messenger_page_id},
146 FcmCredentialSid => $options->{fcm_credential_sid},
147 FriendlyName => $options->{friendly_name},
148 GcmCredentialSid => $options->{gcm_credential_sid},
149 LogEnabled => Twilio::Serialize::boolean_to_string($options->{log_enabled}),
150 MessagingServiceSid => $options->{messaging_service_sid},
151 1 };
152  
153 my $response =
154 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
155 1 return $self->_build_instance($response);
156 }
157  
158 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
159 2 my ($self, $response) = @_;
160 return Twilio::Rest::Notify::V1::ServiceInstance->new($self->{version}, $response->get_content,
161 2 $self->{solution}{sid});
162 }
163  
164 4 ▶sub bindings {
Subroutine bindings: called CC=2 SCAR=6.9
165 4 my ($self, $sid) = @_;
166 4 require Twilio::Rest::Notify::V1::Service::Binding;
167 my $list =
168 4 Twilio::Rest::Notify::V1::Service::BindingList->new($self->{version}, $self->{solution}{sid});
169 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
170 }
171  
172 1 ▶sub notifications {
Subroutine notifications: called CC=1 SCAR=0.0
173 1 my ($self) = @_;
174 1 require Twilio::Rest::Notify::V1::Service::Notification;
175 return Twilio::Rest::Notify::V1::Service::NotificationList->new($self->{version},
176 1 $self->{solution}{sid});
177 }
178  
179 package Twilio::Rest::Notify::V1::ServiceInstance;
180  
181 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
182  
183 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
184  
185 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
186 4 my ($class, $version, $payload, $sid) = @_;
187 4 my $self = $class->SUPER::new($version, $payload);
188 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
189 4 return $self;
190 }
191  
192 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->delete(@arguments);
195 }
196  
197 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
198 0 my ($self, @arguments) = @_;
199 0 return $self->_context->fetch(@arguments);
200 }
201  
202 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
203 0 my ($self, @arguments) = @_;
204 0 return $self->_context->update(@arguments);
205 }
206  
207 0 ▶sub bindings {
Subroutine bindings: not called CC=1 SCAR=6.9
208 0 my ($self, @arguments) = @_;
209 0 return $self->_context->bindings(@arguments);
210 }
211  
212 0 ▶sub notifications {
Subroutine notifications: not called CC=1 SCAR=6.9
213 0 my ($self, @arguments) = @_;
214 0 return $self->_context->notifications(@arguments);
215 }
216  
217 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
218 0 my ($self) = @_;
219 0 return Twilio::Rest::Notify::V1::ServiceContext->new($self->{version}, $self->{solution}{sid});
220 }
221  
222 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
223 4 ▶sub alexa_skill_id { return $_[0]{properties}{alexa_skill_id} }
Subroutine alexa_skill_id: called CC=1 SCAR=0.0
224 4 ▶sub apn_credential_sid { return $_[0]{properties}{apn_credential_sid} }
Subroutine apn_credential_sid: called CC=1 SCAR=0.0
225 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
226 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
227  
228 4 ▶sub default_alexa_notification_protocol_version {
Subroutine default_alexa_notification_protocol_version: called CC=1 SCAR=0.0
229 4 return $_[0]{properties}{default_alexa_notification_protocol_version};
230 }
231  
232 4 ▶sub default_apn_notification_protocol_version {
Subroutine default_apn_notification_protocol_version: called CC=1 SCAR=0.0
233 4 return $_[0]{properties}{default_apn_notification_protocol_version};
234 }
235  
236 4 ▶sub default_fcm_notification_protocol_version {
Subroutine default_fcm_notification_protocol_version: called CC=1 SCAR=0.0
237 4 return $_[0]{properties}{default_fcm_notification_protocol_version};
238 }
239  
240 4 ▶sub default_gcm_notification_protocol_version {
Subroutine default_gcm_notification_protocol_version: called CC=1 SCAR=0.0
241 4 return $_[0]{properties}{default_gcm_notification_protocol_version};
242 }
243 4 ▶sub delivery_callback_enabled { return $_[0]{properties}{delivery_callback_enabled} }
Subroutine delivery_callback_enabled: called CC=1 SCAR=0.0
244 4 ▶sub delivery_callback_url { return $_[0]{properties}{delivery_callback_url} }
Subroutine delivery_callback_url: called CC=1 SCAR=0.0
245 4 ▶sub facebook_messenger_page_id { return $_[0]{properties}{facebook_messenger_page_id} }
Subroutine facebook_messenger_page_id: called CC=1 SCAR=0.0
246 4 ▶sub fcm_credential_sid { return $_[0]{properties}{fcm_credential_sid} }
Subroutine fcm_credential_sid: called CC=1 SCAR=0.0
247 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
248 4 ▶sub gcm_credential_sid { return $_[0]{properties}{gcm_credential_sid} }
Subroutine gcm_credential_sid: called CC=1 SCAR=0.0
249 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
250 4 ▶sub log_enabled { return $_[0]{properties}{log_enabled} }
Subroutine log_enabled: called CC=1 SCAR=0.0
251 4 ▶sub messaging_service_sid { return $_[0]{properties}{messaging_service_sid} }
Subroutine messaging_service_sid: called CC=1 SCAR=0.0
252 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
253 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
254  
255 2 1;
256  
257 __END__
« Twilio/Rest/IpMessaging/V1/Service/Channel/Message.pm ↑ Summary Twilio/Rest/FlexApi/V1/FlexFlow.pm »