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

filter: Statementstmt 84.6% 83 / 98 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 82.5% 33 / 40 Podpod n/a totaltotal 79.6% 121 / 152 CC 5 SCAR 2.9
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Chat/V1/Service/Channel/Member.pm ↑ Summary Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTarget.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::Member;
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::Channel::MemberList;
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 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 5 my ($class, $version, $service_sid, $channel_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { service_sid => $service_sid, channel_sid => $channel_sid };
19 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/Channels/', Twilio::Serialize::path_segment($channel_sid), '/Members';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $identity, $options) = @_;
26 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
27  
28 my $data = {
29 Identity => $identity,
30 RoleSid => $options->{role_sid},
31 1 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::IpMessaging::V1::Service::Channel::MemberInstance->new(
36 $self->{version}, $response->get_content,
37 $self->{solution}{service_sid},
38 $self->{solution}{channel_sid}
39 1 );
40 }
41  
42 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
43 0 my ($self, @arguments) = @_;
44 0 return $self->read_records(@arguments);
45 }
46  
47 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->stream_records(@arguments);
50 }
51  
52 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
53 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
54 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
55  
56 my $params = {
57 Identity => $options->{identity},
58 1 PageToken => $page_token,
59 Page => $page_number,
60 PageSize => $page_size,
61 };
62  
63 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
64 1 return $self->_build_page($response);
65 }
66  
67 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
68 0 my ($self, $target_url) = @_;
69 0 my $client = $self->{version}->get_domain->get_client;
70 0 return $self->_build_page($client->request('GET', $target_url));
71 }
72  
73 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
74 1 my ($self, $response) = @_;
75 return Twilio::Rest::IpMessaging::V1::Service::Channel::MemberPage->new($self->{version},
76 1 $response, $self->{solution});
77 }
78  
79 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
80 3 my ($self, $sid) = @_;
81 return Twilio::Rest::IpMessaging::V1::Service::Channel::MemberContext->new(
82 $self->{version},
83 $self->{solution}{service_sid},
84 3 $self->{solution}{channel_sid}, $sid
85 );
86 }
87  
88 package Twilio::Rest::IpMessaging::V1::Service::Channel::MemberPage;
89  
90 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 1 ▶sub records_key { return 'members' }
Subroutine records_key: called CC=1 SCAR=0.0
93  
94 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
95 1 my ($self, $payload) = @_;
96 return Twilio::Rest::IpMessaging::V1::Service::Channel::MemberInstance->new(
97 $self->{version}, $payload,
98 $self->{solution}{service_sid},
99 $self->{solution}{channel_sid}
100 1 );
101 }
102  
103 package Twilio::Rest::IpMessaging::V1::Service::Channel::MemberContext;
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 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
110 3 my ($class, $version, $service_sid, $channel_sid, $sid) = @_;
111 3 my $self = $class->SUPER::new($version);
112 3 $self->{solution} = { service_sid => $service_sid, channel_sid => $channel_sid, sid => $sid };
113 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
114 '/Channels/', Twilio::Serialize::path_segment($channel_sid), '/Members/',
115 Twilio::Serialize::path_segment($sid);
116 3 return $self;
117 }
118  
119 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
120 1 my ($self) = @_;
121 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
122 1 return 1;
123 }
124  
125 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
126 1 my ($self) = @_;
127  
128 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
129 1 return $self->_build_instance($response);
130 }
131  
132 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
133 1 my ($self, $options) = @_;
134 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
135  
136 my $data = {
137 LastConsumedMessageIndex => $options->{last_consumed_message_index},
138 RoleSid => $options->{role_sid},
139 1 };
140  
141 my $response =
142 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
143 1 return $self->_build_instance($response);
144 }
145  
146 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
147 2 my ($self, $response) = @_;
148 return Twilio::Rest::IpMessaging::V1::Service::Channel::MemberInstance->new(
149 $self->{version}, $response->get_content,
150 $self->{solution}{service_sid},
151 $self->{solution}{channel_sid},
152 $self->{solution}{sid}
153 2 );
154 }
155  
156 package Twilio::Rest::IpMessaging::V1::Service::Channel::MemberInstance;
157  
158 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
159  
160 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
161  
162 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
163 4 my ($class, $version, $payload, $service_sid, $channel_sid, $sid) = @_;
164 4 my $self = $class->SUPER::new($version, $payload);
165 $self->{solution} = {
166 service_sid => $service_sid,
167 channel_sid => $channel_sid,
168 sid => $sid // $self->{properties}{sid}
169 4 ▶ };
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
170 4 return $self;
171 }
172  
173 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
174 0 my ($self, @arguments) = @_;
175 0 return $self->_context->delete(@arguments);
176 }
177  
178 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
179 0 my ($self, @arguments) = @_;
180 0 return $self->_context->fetch(@arguments);
181 }
182  
183 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
184 0 my ($self, @arguments) = @_;
185 0 return $self->_context->update(@arguments);
186 }
187  
188 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
189 0 my ($self) = @_;
190 return Twilio::Rest::IpMessaging::V1::Service::Channel::MemberContext->new(
191 $self->{version},
192 $self->{solution}{service_sid},
193 $self->{solution}{channel_sid},
194 $self->{solution}{sid}
195 0 );
196 }
197  
198 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
199 4 ▶sub channel_sid { return $_[0]{properties}{channel_sid} }
Subroutine channel_sid: called CC=1 SCAR=0.0
200 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
201 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
202 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
203 4 ▶sub last_consumed_message_index { return $_[0]{properties}{last_consumed_message_index} }
Subroutine last_consumed_message_index: called CC=1 SCAR=0.0
204  
205 4 ▶sub last_consumption_timestamp {
Subroutine last_consumption_timestamp: called CC=1 SCAR=0.0
206 4 return Twilio::Deserialize::date_time($_[0]{properties}{last_consumption_timestamp});
207 }
208 4 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
209 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
210 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
211 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
212  
213 2 1;
214  
215 __END__
« Twilio/Rest/Chat/V1/Service/Channel/Member.pm ↑ Summary Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTarget.pm »