Twilio/Rest/IpMessaging/V2/Service.pm

filter: Statementstmt 82.7% 110 / 133 Branchbran 100% 8 / 8 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 81.6% 49 / 60 Podpod n/a totaltotal 80.6% 171 / 212 CC 8 SCAR 3.2
CC
8
Cov
82%
page
2.0
update
2.0
new
2.0
CRAP 1.4
« Twilio/Rest/Chat/V2/Service.pm ↑ Summary Twilio/Rest/Bulkexports/V1/Export.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::IpMessaging::V2::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::V2::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 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=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::V2::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::V2::ServicePage->new($self->{version}, $response,
67 1 $self->{solution});
68 }
69  
70 47 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
71 47 my ($self, $sid) = @_;
72 47 return Twilio::Rest::IpMessaging::V2::ServiceContext->new($self->{version}, $sid);
73 }
74  
75 package Twilio::Rest::IpMessaging::V2::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::V2::ServiceInstance->new($self->{version}, $payload);
84 }
85  
86 package Twilio::Rest::IpMessaging::V2::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 47 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
93 47 my ($class, $version, $sid) = @_;
94 47 my $self = $class->SUPER::new($version);
95 47 $self->{solution} = { sid => $sid };
96 47 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
97 47 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 'Media.CompatibilityMessage' => $options->{media_compatibility_message},
126 'Notifications.AddedToChannel.Enabled' =>
127 Twilio::Serialize::boolean_to_string($options->{notifications_added_to_channel_enabled}),
128 'Notifications.AddedToChannel.Sound' => $options->{notifications_added_to_channel_sound},
129 'Notifications.AddedToChannel.Template' => $options->{notifications_added_to_channel_template},
130 'Notifications.InvitedToChannel.Enabled' =>
131 Twilio::Serialize::boolean_to_string($options->{notifications_invited_to_channel_enabled}),
132 'Notifications.InvitedToChannel.Sound' => $options->{notifications_invited_to_channel_sound},
133 'Notifications.InvitedToChannel.Template' =>
134 $options->{notifications_invited_to_channel_template},
135 'Notifications.LogEnabled' =>
136 Twilio::Serialize::boolean_to_string($options->{notifications_log_enabled}),
137 'Notifications.NewMessage.BadgeCountEnabled' => Twilio::Serialize::boolean_to_string(
138 $options->{notifications_new_message_badge_count_enabled}
139 ),
140 'Notifications.NewMessage.Enabled' =>
141 Twilio::Serialize::boolean_to_string($options->{notifications_new_message_enabled}),
142 'Notifications.NewMessage.Sound' => $options->{notifications_new_message_sound},
143 'Notifications.NewMessage.Template' => $options->{notifications_new_message_template},
144 'Notifications.RemovedFromChannel.Enabled' =>
145 Twilio::Serialize::boolean_to_string($options->{notifications_removed_from_channel_enabled}),
146 'Notifications.RemovedFromChannel.Sound' =>
147 $options->{notifications_removed_from_channel_sound},
148 'Notifications.RemovedFromChannel.Template' =>
149 $options->{notifications_removed_from_channel_template},
150 PostWebhookRetryCount => $options->{post_webhook_retry_count},
151 PostWebhookUrl => $options->{post_webhook_url},
152 PreWebhookRetryCount => $options->{pre_webhook_retry_count},
153 PreWebhookUrl => $options->{pre_webhook_url},
154 ReachabilityEnabled => Twilio::Serialize::boolean_to_string($options->{reachability_enabled}),
155 ReadStatusEnabled => Twilio::Serialize::boolean_to_string($options->{read_status_enabled}),
156 TypingIndicatorTimeout => $options->{typing_indicator_timeout},
157 WebhookFilters => $options->{webhook_filters},
158 WebhookMethod => $options->{webhook_method},
159 1 };
160  
161 my $response =
162 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
163 1 return $self->_build_instance($response);
164 }
165  
166 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
167 2 my ($self, $response) = @_;
168 return Twilio::Rest::IpMessaging::V2::ServiceInstance->new($self->{version},
169 2 $response->get_content, $self->{solution}{sid});
170 }
171  
172 3 ▶sub bindings {
Subroutine bindings: called CC=2 SCAR=6.9
173 3 my ($self, $sid) = @_;
174 3 require Twilio::Rest::IpMessaging::V2::Service::Binding;
175 my $list = Twilio::Rest::IpMessaging::V2::Service::BindingList->new($self->{version},
176 3 $self->{solution}{sid});
177 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
178 }
179  
180 24 ▶sub channels {
Subroutine channels: called CC=2 SCAR=6.9
181 24 my ($self, $sid) = @_;
182 24 require Twilio::Rest::IpMessaging::V2::Service::Channel;
183 my $list = Twilio::Rest::IpMessaging::V2::Service::ChannelList->new($self->{version},
184 24 $self->{solution}{sid});
185 24 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 22 2 24
186 }
187  
188 5 ▶sub roles {
Subroutine roles: called CC=2 SCAR=6.9
189 5 my ($self, $sid) = @_;
190 5 require Twilio::Rest::IpMessaging::V2::Service::Role;
191 my $list =
192 5 Twilio::Rest::IpMessaging::V2::Service::RoleList->new($self->{version}, $self->{solution}{sid});
193 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
194 }
195  
196 12 ▶sub users {
Subroutine users: called CC=2 SCAR=6.9
197 12 my ($self, $sid) = @_;
198 12 require Twilio::Rest::IpMessaging::V2::Service::User;
199 my $list =
200 12 Twilio::Rest::IpMessaging::V2::Service::UserList->new($self->{version}, $self->{solution}{sid});
201 12 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 10 2 12
202 }
203  
204 package Twilio::Rest::IpMessaging::V2::ServiceInstance;
205  
206 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
207  
208 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
209  
210 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
211 4 my ($class, $version, $payload, $sid) = @_;
212 4 my $self = $class->SUPER::new($version, $payload);
213 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
214 4 return $self;
215 }
216  
217 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
218 0 my ($self, @arguments) = @_;
219 0 return $self->_context->delete(@arguments);
220 }
221  
222 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
223 0 my ($self, @arguments) = @_;
224 0 return $self->_context->fetch(@arguments);
225 }
226  
227 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
228 0 my ($self, @arguments) = @_;
229 0 return $self->_context->update(@arguments);
230 }
231  
232 0 ▶sub bindings {
Subroutine bindings: not called CC=1 SCAR=6.9
233 0 my ($self, @arguments) = @_;
234 0 return $self->_context->bindings(@arguments);
235 }
236  
237 0 ▶sub channels {
Subroutine channels: not called CC=1 SCAR=6.9
238 0 my ($self, @arguments) = @_;
239 0 return $self->_context->channels(@arguments);
240 }
241  
242 0 ▶sub roles {
Subroutine roles: not called CC=1 SCAR=6.9
243 0 my ($self, @arguments) = @_;
244 0 return $self->_context->roles(@arguments);
245 }
246  
247 0 ▶sub users {
Subroutine users: not called CC=1 SCAR=6.9
248 0 my ($self, @arguments) = @_;
249 0 return $self->_context->users(@arguments);
250 }
251  
252 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
253 0 my ($self) = @_;
254 return Twilio::Rest::IpMessaging::V2::ServiceContext->new($self->{version},
255 0 $self->{solution}{sid});
256 }
257  
258 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
259 4 ▶sub consumption_report_interval { return $_[0]{properties}{consumption_report_interval} }
Subroutine consumption_report_interval: called CC=1 SCAR=0.0
260 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
261 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
262 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
263 4 ▶sub default_channel_role_sid { return $_[0]{properties}{default_channel_role_sid} }
Subroutine default_channel_role_sid: called CC=1 SCAR=0.0
264 4 ▶sub default_service_role_sid { return $_[0]{properties}{default_service_role_sid} }
Subroutine default_service_role_sid: called CC=1 SCAR=0.0
265 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
266 4 ▶sub limits { return $_[0]{properties}{limits} }
Subroutine limits: called CC=1 SCAR=0.0
267 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
268 4 ▶sub media { return $_[0]{properties}{media} }
Subroutine media: called CC=1 SCAR=0.0
269 4 ▶sub notifications { return $_[0]{properties}{notifications} }
Subroutine notifications: called CC=1 SCAR=0.0
270 4 ▶sub post_webhook_retry_count { return $_[0]{properties}{post_webhook_retry_count} }
Subroutine post_webhook_retry_count: called CC=1 SCAR=0.0
271 4 ▶sub post_webhook_url { return $_[0]{properties}{post_webhook_url} }
Subroutine post_webhook_url: called CC=1 SCAR=0.0
272 4 ▶sub pre_webhook_retry_count { return $_[0]{properties}{pre_webhook_retry_count} }
Subroutine pre_webhook_retry_count: called CC=1 SCAR=0.0
273 4 ▶sub pre_webhook_url { return $_[0]{properties}{pre_webhook_url} }
Subroutine pre_webhook_url: called CC=1 SCAR=0.0
274 4 ▶sub reachability_enabled { return $_[0]{properties}{reachability_enabled} }
Subroutine reachability_enabled: called CC=1 SCAR=0.0
275 4 ▶sub read_status_enabled { return $_[0]{properties}{read_status_enabled} }
Subroutine read_status_enabled: called CC=1 SCAR=0.0
276 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
277 4 ▶sub typing_indicator_timeout { return $_[0]{properties}{typing_indicator_timeout} }
Subroutine typing_indicator_timeout: called CC=1 SCAR=0.0
278 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
279 4 ▶sub webhook_filters { return $_[0]{properties}{webhook_filters} }
Subroutine webhook_filters: called CC=1 SCAR=0.0
280 4 ▶sub webhook_method { return $_[0]{properties}{webhook_method} }
Subroutine webhook_method: called CC=1 SCAR=0.0
281  
282 2 1;
283  
284 __END__
« Twilio/Rest/Chat/V2/Service.pm ↑ Summary Twilio/Rest/Bulkexports/V1/Export.pm »