Twilio/Rest/IpMessaging/V1/Service.pm

filter: Statementstmt 83.2% 104 / 125 Branchbran 100% 6 / 6 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 82.1% 46 / 56 Podpod n/a totaltotal 80.8% 160 / 198 CC 7 SCAR 3.0
CC
7
Cov
83%
page
2.0
update
2.0
new
2.0
CRAP 1.4
« Twilio/Rest/Chat/V1/Service.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Key.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::IpMessaging::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::IpMessaging::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 35 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 35 my ($class, $version) = @_;
17 35 my $self = $class->SUPER::new($version);
18 35 $self->{solution} = {};
19 35 $self->{uri} = '/Services';
20 35 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 1 my ($self, $friendly_name) = @_;
25  
26 1 my $data = { FriendlyName => $friendly_name, };
27  
28 my $response =
29 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
30 return Twilio::Rest::IpMessaging::V1::ServiceInstance->new($self->{version},
31 1 $response->get_content);
32 }
33  
34 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
35 0 my ($self, @arguments) = @_;
36 0 return $self->read_records(@arguments);
37 }
38  
39 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->stream_records(@arguments);
42 }
43  
44 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
45 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
46 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
47  
48 1 my $params = {
49 PageToken => $page_token,
50 Page => $page_number,
51 PageSize => $page_size,
52 };
53  
54 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
55 1 return $self->_build_page($response);
56 }
57  
58 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
59 0 my ($self, $target_url) = @_;
60 0 my $client = $self->{version}->get_domain->get_client;
61 0 return $self->_build_page($client->request('GET', $target_url));
62 }
63  
64 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
65 1 my ($self, $response) = @_;
66 return Twilio::Rest::IpMessaging::V1::ServicePage->new($self->{version}, $response,
67 1 $self->{solution});
68 }
69  
70 33 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
71 33 my ($self, $sid) = @_;
72 33 return Twilio::Rest::IpMessaging::V1::ServiceContext->new($self->{version}, $sid);
73 }
74  
75 package Twilio::Rest::IpMessaging::V1::ServicePage;
76  
77 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
78  
79 1 ▶sub records_key { return 'services' }
Subroutine records_key: called CC=1 SCAR=0.0
80  
81 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
82 1 my ($self, $payload) = @_;
83 1 return Twilio::Rest::IpMessaging::V1::ServiceInstance->new($self->{version}, $payload);
84 }
85  
86 package Twilio::Rest::IpMessaging::V1::ServiceContext;
87  
88 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 33 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
93 33 my ($class, $version, $sid) = @_;
94 33 my $self = $class->SUPER::new($version);
95 33 $self->{solution} = { sid => $sid };
96 33 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
97 33 return $self;
98 }
99  
100 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
101 1 my ($self) = @_;
102 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
103 1 return 1;
104 }
105  
106 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
107 1 my ($self) = @_;
108  
109 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
110 1 return $self->_build_instance($response);
111 }
112  
113 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
114 1 my ($self, $options) = @_;
115 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
116  
117 my $data = {
118 ConsumptionReportInterval => $options->{consumption_report_interval},
119 DefaultChannelCreatorRoleSid => $options->{default_channel_creator_role_sid},
120 DefaultChannelRoleSid => $options->{default_channel_role_sid},
121 DefaultServiceRoleSid => $options->{default_service_role_sid},
122 FriendlyName => $options->{friendly_name},
123 'Limits.ChannelMembers' => $options->{limits_channel_members},
124 'Limits.UserChannels' => $options->{limits_user_channels},
125 'Notifications.AddedToChannel.Enabled' =>
126 Twilio::Serialize::boolean_to_string($options->{notifications_added_to_channel_enabled}),
127 'Notifications.AddedToChannel.Template' => $options->{notifications_added_to_channel_template},
128 'Notifications.InvitedToChannel.Enabled' =>
129 Twilio::Serialize::boolean_to_string($options->{notifications_invited_to_channel_enabled}),
130 'Notifications.InvitedToChannel.Template' =>
131 $options->{notifications_invited_to_channel_template},
132 'Notifications.NewMessage.Enabled' =>
133 Twilio::Serialize::boolean_to_string($options->{notifications_new_message_enabled}),
134 'Notifications.NewMessage.Template' => $options->{notifications_new_message_template},
135 'Notifications.RemovedFromChannel.Enabled' =>
136 Twilio::Serialize::boolean_to_string($options->{notifications_removed_from_channel_enabled}),
137 'Notifications.RemovedFromChannel.Template' =>
138 $options->{notifications_removed_from_channel_template},
139 PostWebhookUrl => $options->{post_webhook_url},
140 PreWebhookUrl => $options->{pre_webhook_url},
141 ReachabilityEnabled => Twilio::Serialize::boolean_to_string($options->{reachability_enabled}),
142 ReadStatusEnabled => Twilio::Serialize::boolean_to_string($options->{read_status_enabled}),
143 TypingIndicatorTimeout => $options->{typing_indicator_timeout},
144 WebhookFilters => $options->{webhook_filters},
145 WebhookMethod => $options->{webhook_method},
146 'Webhooks.OnChannelAdd.Method' => $options->{webhooks_on_channel_add_method},
147 'Webhooks.OnChannelAdd.Url' => $options->{webhooks_on_channel_add_url},
148 'Webhooks.OnChannelAdded.Method' => $options->{webhooks_on_channel_added_method},
149 'Webhooks.OnChannelAdded.Url' => $options->{webhooks_on_channel_added_url},
150 'Webhooks.OnChannelDestroy.Method' => $options->{webhooks_on_channel_destroy_method},
151 'Webhooks.OnChannelDestroy.Url' => $options->{webhooks_on_channel_destroy_url},
152 'Webhooks.OnChannelDestroyed.Method' => $options->{webhooks_on_channel_destroyed_method},
153 'Webhooks.OnChannelDestroyed.Url' => $options->{webhooks_on_channel_destroyed_url},
154 'Webhooks.OnChannelUpdate.Method' => $options->{webhooks_on_channel_update_method},
155 'Webhooks.OnChannelUpdate.Url' => $options->{webhooks_on_channel_update_url},
156 'Webhooks.OnChannelUpdated.Method' => $options->{webhooks_on_channel_updated_method},
157 'Webhooks.OnChannelUpdated.Url' => $options->{webhooks_on_channel_updated_url},
158 'Webhooks.OnMemberAdd.Method' => $options->{webhooks_on_member_add_method},
159 'Webhooks.OnMemberAdd.Url' => $options->{webhooks_on_member_add_url},
160 'Webhooks.OnMemberAdded.Method' => $options->{webhooks_on_member_added_method},
161 'Webhooks.OnMemberAdded.Url' => $options->{webhooks_on_member_added_url},
162 'Webhooks.OnMemberRemove.Method' => $options->{webhooks_on_member_remove_method},
163 'Webhooks.OnMemberRemove.Url' => $options->{webhooks_on_member_remove_url},
164 'Webhooks.OnMemberRemoved.Method' => $options->{webhooks_on_member_removed_method},
165 'Webhooks.OnMemberRemoved.Url' => $options->{webhooks_on_member_removed_url},
166 'Webhooks.OnMessageRemove.Method' => $options->{webhooks_on_message_remove_method},
167 'Webhooks.OnMessageRemove.Url' => $options->{webhooks_on_message_remove_url},
168 'Webhooks.OnMessageRemoved.Method' => $options->{webhooks_on_message_removed_method},
169 'Webhooks.OnMessageRemoved.Url' => $options->{webhooks_on_message_removed_url},
170 'Webhooks.OnMessageSend.Method' => $options->{webhooks_on_message_send_method},
171 'Webhooks.OnMessageSend.Url' => $options->{webhooks_on_message_send_url},
172 'Webhooks.OnMessageSent.Method' => $options->{webhooks_on_message_sent_method},
173 'Webhooks.OnMessageSent.Url' => $options->{webhooks_on_message_sent_url},
174 'Webhooks.OnMessageUpdate.Method' => $options->{webhooks_on_message_update_method},
175 'Webhooks.OnMessageUpdate.Url' => $options->{webhooks_on_message_update_url},
176 'Webhooks.OnMessageUpdated.Method' => $options->{webhooks_on_message_updated_method},
177 'Webhooks.OnMessageUpdated.Url' => $options->{webhooks_on_message_updated_url},
178 1 };
179  
180 my $response =
181 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
182 1 return $self->_build_instance($response);
183 }
184  
185 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
186 2 my ($self, $response) = @_;
187 return Twilio::Rest::IpMessaging::V1::ServiceInstance->new($self->{version},
188 2 $response->get_content, $self->{solution}{sid});
189 }
190  
191 19 ▶sub channels {
Subroutine channels: called CC=2 SCAR=6.9
192 19 my ($self, $sid) = @_;
193 19 require Twilio::Rest::IpMessaging::V1::Service::Channel;
194 my $list = Twilio::Rest::IpMessaging::V1::Service::ChannelList->new($self->{version},
195 19 $self->{solution}{sid});
196 19 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 17 2 19
197 }
198  
199 5 ▶sub roles {
Subroutine roles: called CC=2 SCAR=6.9
200 5 my ($self, $sid) = @_;
201 5 require Twilio::Rest::IpMessaging::V1::Service::Role;
202 my $list =
203 5 Twilio::Rest::IpMessaging::V1::Service::RoleList->new($self->{version}, $self->{solution}{sid});
204 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
205 }
206  
207 6 ▶sub users {
Subroutine users: called CC=2 SCAR=6.9
208 6 my ($self, $sid) = @_;
209 6 require Twilio::Rest::IpMessaging::V1::Service::User;
210 my $list =
211 6 Twilio::Rest::IpMessaging::V1::Service::UserList->new($self->{version}, $self->{solution}{sid});
212 6 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 4 2 6
213 }
214  
215 package Twilio::Rest::IpMessaging::V1::ServiceInstance;
216  
217 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
218  
219 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
220  
221 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
222 4 my ($class, $version, $payload, $sid) = @_;
223 4 my $self = $class->SUPER::new($version, $payload);
224 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
225 4 return $self;
226 }
227  
228 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
229 0 my ($self, @arguments) = @_;
230 0 return $self->_context->delete(@arguments);
231 }
232  
233 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
234 0 my ($self, @arguments) = @_;
235 0 return $self->_context->fetch(@arguments);
236 }
237  
238 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
239 0 my ($self, @arguments) = @_;
240 0 return $self->_context->update(@arguments);
241 }
242  
243 0 ▶sub channels {
Subroutine channels: not called CC=1 SCAR=6.9
244 0 my ($self, @arguments) = @_;
245 0 return $self->_context->channels(@arguments);
246 }
247  
248 0 ▶sub roles {
Subroutine roles: not called CC=1 SCAR=6.9
249 0 my ($self, @arguments) = @_;
250 0 return $self->_context->roles(@arguments);
251 }
252  
253 0 ▶sub users {
Subroutine users: not called CC=1 SCAR=6.9
254 0 my ($self, @arguments) = @_;
255 0 return $self->_context->users(@arguments);
256 }
257  
258 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
259 0 my ($self) = @_;
260 return Twilio::Rest::IpMessaging::V1::ServiceContext->new($self->{version},
261 0 $self->{solution}{sid});
262 }
263  
264 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
265 4 ▶sub consumption_report_interval { return $_[0]{properties}{consumption_report_interval} }
Subroutine consumption_report_interval: called CC=1 SCAR=0.0
266 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
267 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
268 4 ▶sub default_channel_creator_role_sid { return $_[0]{properties}{default_channel_creator_role_sid} }
Subroutine default_channel_creator_role_sid: called CC=1 SCAR=0.0
269 4 ▶sub default_channel_role_sid { return $_[0]{properties}{default_channel_role_sid} }
Subroutine default_channel_role_sid: called CC=1 SCAR=0.0
270 4 ▶sub default_service_role_sid { return $_[0]{properties}{default_service_role_sid} }
Subroutine default_service_role_sid: called CC=1 SCAR=0.0
271 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
272 4 ▶sub limits { return $_[0]{properties}{limits} }
Subroutine limits: called CC=1 SCAR=0.0
273 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
274 4 ▶sub notifications { return $_[0]{properties}{notifications} }
Subroutine notifications: called CC=1 SCAR=0.0
275 4 ▶sub post_webhook_url { return $_[0]{properties}{post_webhook_url} }
Subroutine post_webhook_url: called CC=1 SCAR=0.0
276 4 ▶sub pre_webhook_url { return $_[0]{properties}{pre_webhook_url} }
Subroutine pre_webhook_url: called CC=1 SCAR=0.0
277 4 ▶sub reachability_enabled { return $_[0]{properties}{reachability_enabled} }
Subroutine reachability_enabled: called CC=1 SCAR=0.0
278 4 ▶sub read_status_enabled { return $_[0]{properties}{read_status_enabled} }
Subroutine read_status_enabled: called CC=1 SCAR=0.0
279 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
280 4 ▶sub typing_indicator_timeout { return $_[0]{properties}{typing_indicator_timeout} }
Subroutine typing_indicator_timeout: called CC=1 SCAR=0.0
281 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
282 4 ▶sub webhook_filters { return $_[0]{properties}{webhook_filters} }
Subroutine webhook_filters: called CC=1 SCAR=0.0
283 4 ▶sub webhook_method { return $_[0]{properties}{webhook_method} }
Subroutine webhook_method: called CC=1 SCAR=0.0
284 4 ▶sub webhooks { return $_[0]{properties}{webhooks} }
Subroutine webhooks: called CC=1 SCAR=0.0
285  
286 2 1;
287  
288 __END__
« Twilio/Rest/Chat/V1/Service.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Key.pm »