Twilio/Rest/IpMessaging/V1/Service/Channel.pm

filter: Statementstmt 82.3% 98 / 119 Branchbran 100% 6 / 6 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 79.5% 39 / 49 Podpod n/a totaltotal 78.7% 148 / 188 CC 8 SCAR 3.6
CC
8
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Chat/V1/Service/Channel.pm ↑ Summary Twilio/Rest/Messaging/V2/ChannelsSender.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::IpMessaging::V1::Service::Channel;
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::Service::ChannelList;
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 19 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 19 my ($class, $version, $service_sid) = @_;
17 19 my $self = $class->SUPER::new($version);
18 19 $self->{solution} = { service_sid => $service_sid };
19 19 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Channels';
20 19 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 Attributes => $options->{attributes},
29 FriendlyName => $options->{friendly_name},
30 Type => $options->{type},
31 UniqueName => $options->{unique_name},
32 1 };
33  
34 my $response =
35 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
36 return Twilio::Rest::IpMessaging::V1::Service::ChannelInstance->new($self->{version},
37 1 $response->get_content, $self->{solution}{service_sid});
38 }
39  
40 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
41 0 my ($self, @arguments) = @_;
42 0 return $self->read_records(@arguments);
43 }
44  
45 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->stream_records(@arguments);
48 }
49  
50 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
51 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
52 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
53  
54 my $params = {
55 Type => $options->{type},
56 1 PageToken => $page_token,
57 Page => $page_number,
58 PageSize => $page_size,
59 };
60  
61 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
62 1 return $self->_build_page($response);
63 }
64  
65 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
66 0 my ($self, $target_url) = @_;
67 0 my $client = $self->{version}->get_domain->get_client;
68 0 return $self->_build_page($client->request('GET', $target_url));
69 }
70  
71 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
72 1 my ($self, $response) = @_;
73 return Twilio::Rest::IpMessaging::V1::Service::ChannelPage->new($self->{version}, $response,
74 1 $self->{solution});
75 }
76  
77 17 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
78 17 my ($self, $sid) = @_;
79 return Twilio::Rest::IpMessaging::V1::Service::ChannelContext->new($self->{version},
80 17 $self->{solution}{service_sid}, $sid);
81 }
82  
83 package Twilio::Rest::IpMessaging::V1::Service::ChannelPage;
84  
85 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'channels' }
Subroutine records_key: called CC=1 SCAR=0.0
88  
89 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
90 1 my ($self, $payload) = @_;
91 return Twilio::Rest::IpMessaging::V1::Service::ChannelInstance->new($self->{version}, $payload,
92 1 $self->{solution}{service_sid});
93 }
94  
95 package Twilio::Rest::IpMessaging::V1::Service::ChannelContext;
96  
97 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 17 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 17 my ($class, $version, $service_sid, $sid) = @_;
103 17 my $self = $class->SUPER::new($version);
104 17 $self->{solution} = { service_sid => $service_sid, sid => $sid };
105 17 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
106 '/Channels/', Twilio::Serialize::path_segment($sid);
107 17 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 Attributes => $options->{attributes},
129 FriendlyName => $options->{friendly_name},
130 UniqueName => $options->{unique_name},
131 1 };
132  
133 my $response =
134 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
135 1 return $self->_build_instance($response);
136 }
137  
138 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
139 2 my ($self, $response) = @_;
140 return Twilio::Rest::IpMessaging::V1::Service::ChannelInstance->new(
141 $self->{version}, $response->get_content,
142 $self->{solution}{service_sid}, $self->{solution}{sid}
143 2 );
144 }
145  
146 4 ▶sub invites {
Subroutine invites: called CC=2 SCAR=6.9
147 4 my ($self, $sid) = @_;
148 4 require Twilio::Rest::IpMessaging::V1::Service::Channel::Invite;
149 my $list = Twilio::Rest::IpMessaging::V1::Service::Channel::InviteList->new(
150 $self->{version},
151 $self->{solution}{service_sid},
152 $self->{solution}{sid}
153 4 );
154 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
155 }
156  
157 5 ▶sub members {
Subroutine members: called CC=2 SCAR=6.9
158 5 my ($self, $sid) = @_;
159 5 require Twilio::Rest::IpMessaging::V1::Service::Channel::Member;
160 my $list = Twilio::Rest::IpMessaging::V1::Service::Channel::MemberList->new(
161 $self->{version},
162 $self->{solution}{service_sid},
163 $self->{solution}{sid}
164 5 );
165 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
166 }
167  
168 5 ▶sub messages {
Subroutine messages: called CC=2 SCAR=6.9
169 5 my ($self, $sid) = @_;
170 5 require Twilio::Rest::IpMessaging::V1::Service::Channel::Message;
171 my $list = Twilio::Rest::IpMessaging::V1::Service::Channel::MessageList->new(
172 $self->{version},
173 $self->{solution}{service_sid},
174 $self->{solution}{sid}
175 5 );
176 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
177 }
178  
179 package Twilio::Rest::IpMessaging::V1::Service::ChannelInstance;
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, $service_sid, $sid) = @_;
187 4 my $self = $class->SUPER::new($version, $payload);
188 4 ▶ $self->{solution} = { service_sid => $service_sid, 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 invites {
Subroutine invites: not called CC=1 SCAR=6.9
208 0 my ($self, @arguments) = @_;
209 0 return $self->_context->invites(@arguments);
210 }
211  
212 0 ▶sub members {
Subroutine members: not called CC=1 SCAR=6.9
213 0 my ($self, @arguments) = @_;
214 0 return $self->_context->members(@arguments);
215 }
216  
217 0 ▶sub messages {
Subroutine messages: not called CC=1 SCAR=6.9
218 0 my ($self, @arguments) = @_;
219 0 return $self->_context->messages(@arguments);
220 }
221  
222 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
223 0 my ($self) = @_;
224 return Twilio::Rest::IpMessaging::V1::Service::ChannelContext->new(
225 $self->{version},
226 $self->{solution}{service_sid},
227 $self->{solution}{sid}
228 0 );
229 }
230  
231 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
232 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
233 4 ▶sub created_by { return $_[0]{properties}{created_by} }
Subroutine created_by: called CC=1 SCAR=0.0
234 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
235 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
236 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
237 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
238 4 ▶sub members_count { return $_[0]{properties}{members_count} }
Subroutine members_count: called CC=1 SCAR=0.0
239 4 ▶sub messages_count { return $_[0]{properties}{messages_count} }
Subroutine messages_count: called CC=1 SCAR=0.0
240 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
241 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
242 4 ▶sub type { return $_[0]{properties}{type} }
Subroutine type: called CC=1 SCAR=0.0
243 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
244 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
245  
246 2 1;
247  
248 __END__
« Twilio/Rest/Chat/V1/Service/Channel.pm ↑ Summary Twilio/Rest/Messaging/V2/ChannelsSender.pm »