Twilio/Rest/Chat/V2/Service/Channel/Member.pm

filter: Statementstmt 85.0% 85 / 100 Branchbran n/a Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 82.9% 34 / 41 Podpod n/a totaltotal 79.1% 125 / 158 CC 6 SCAR 3.2
CC
6
Cov
82%
delete
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Verify/V2/Service/Entity.pm ↑ Summary Twilio/Rest/Conversations/V1/Conversation/Participant.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Chat::V2::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::Chat::V2::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 Attributes => $options->{attributes},
31 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
32 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
33 LastConsumedMessageIndex => $options->{last_consumed_message_index},
34 LastConsumptionTimestamp =>
35 Twilio::Serialize::iso8601_date_time($options->{last_consumption_timestamp}),
36 RoleSid => $options->{role_sid},
37 1 };
38  
39 my $response = $self->{version}->handle_request(
40 'POST',
41 $self->{uri},
42 'create',
43 {
44 data => $data,
45 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
46 }
47 1 );
48 return Twilio::Rest::Chat::V2::Service::Channel::MemberInstance->new(
49 $self->{version}, $response->get_content,
50 $self->{solution}{service_sid},
51 $self->{solution}{channel_sid}
52 1 );
53 }
54  
55 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
56 0 my ($self, @arguments) = @_;
57 0 return $self->read_records(@arguments);
58 }
59  
60 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
61 0 my ($self, @arguments) = @_;
62 0 return $self->stream_records(@arguments);
63 }
64  
65 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
66 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
67 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
68  
69 my $params = {
70 Identity => $options->{identity},
71 1 PageToken => $page_token,
72 Page => $page_number,
73 PageSize => $page_size,
74 };
75  
76 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
77 1 return $self->_build_page($response);
78 }
79  
80 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
81 0 my ($self, $target_url) = @_;
82 0 my $client = $self->{version}->get_domain->get_client;
83 0 return $self->_build_page($client->request('GET', $target_url));
84 }
85  
86 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
87 1 my ($self, $response) = @_;
88 return Twilio::Rest::Chat::V2::Service::Channel::MemberPage->new($self->{version}, $response,
89 1 $self->{solution});
90 }
91  
92 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
93 3 my ($self, $sid) = @_;
94 return Twilio::Rest::Chat::V2::Service::Channel::MemberContext->new(
95 $self->{version},
96 $self->{solution}{service_sid},
97 3 $self->{solution}{channel_sid}, $sid
98 );
99 }
100  
101 package Twilio::Rest::Chat::V2::Service::Channel::MemberPage;
102  
103 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 1 ▶sub records_key { return 'members' }
Subroutine records_key: called CC=1 SCAR=0.0
106  
107 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
108 1 my ($self, $payload) = @_;
109 return Twilio::Rest::Chat::V2::Service::Channel::MemberInstance->new(
110 $self->{version}, $payload,
111 $self->{solution}{service_sid},
112 $self->{solution}{channel_sid}
113 1 );
114 }
115  
116 package Twilio::Rest::Chat::V2::Service::Channel::MemberContext;
117  
118 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
119  
120 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
121  
122 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
123 3 my ($class, $version, $service_sid, $channel_sid, $sid) = @_;
124 3 my $self = $class->SUPER::new($version);
125 3 $self->{solution} = { service_sid => $service_sid, channel_sid => $channel_sid, sid => $sid };
126 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
127 '/Channels/', Twilio::Serialize::path_segment($channel_sid), '/Members/',
128 Twilio::Serialize::path_segment($sid);
129 3 return $self;
130 }
131  
132 1 ▶sub delete {
Subroutine delete: 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 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
136 1 { headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, } });
137 1 return 1;
138 }
139  
140 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
141 1 my ($self) = @_;
142  
143 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
144 1 return $self->_build_instance($response);
145 }
146  
147 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
148 1 my ($self, $options) = @_;
149 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
150  
151 my $data = {
152 Attributes => $options->{attributes},
153 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
154 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
155 LastConsumedMessageIndex => $options->{last_consumed_message_index},
156 LastConsumptionTimestamp =>
157 Twilio::Serialize::iso8601_date_time($options->{last_consumption_timestamp}),
158 RoleSid => $options->{role_sid},
159 1 };
160  
161 my $response = $self->{version}->handle_request(
162 'POST',
163 $self->{uri},
164 'update',
165 {
166 data => $data,
167 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
168 }
169 1 );
170 1 return $self->_build_instance($response);
171 }
172  
173 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
174 2 my ($self, $response) = @_;
175 return Twilio::Rest::Chat::V2::Service::Channel::MemberInstance->new(
176 $self->{version}, $response->get_content,
177 $self->{solution}{service_sid},
178 $self->{solution}{channel_sid},
179 $self->{solution}{sid}
180 2 );
181 }
182  
183 package Twilio::Rest::Chat::V2::Service::Channel::MemberInstance;
184  
185 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
186  
187 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
188  
189 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
190 4 my ($class, $version, $payload, $service_sid, $channel_sid, $sid) = @_;
191 4 my $self = $class->SUPER::new($version, $payload);
192 $self->{solution} = {
193 service_sid => $service_sid,
194 channel_sid => $channel_sid,
195 sid => $sid // $self->{properties}{sid}
196 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
197 4 return $self;
198 }
199  
200 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
201 0 my ($self, @arguments) = @_;
202 0 return $self->_context->delete(@arguments);
203 }
204  
205 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
206 0 my ($self, @arguments) = @_;
207 0 return $self->_context->fetch(@arguments);
208 }
209  
210 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
211 0 my ($self, @arguments) = @_;
212 0 return $self->_context->update(@arguments);
213 }
214  
215 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
216 0 my ($self) = @_;
217 return Twilio::Rest::Chat::V2::Service::Channel::MemberContext->new(
218 $self->{version},
219 $self->{solution}{service_sid},
220 $self->{solution}{channel_sid},
221 $self->{solution}{sid}
222 0 );
223 }
224  
225 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
226 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
227 4 ▶sub channel_sid { return $_[0]{properties}{channel_sid} }
Subroutine channel_sid: called CC=1 SCAR=0.0
228 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
229 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
230 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
231 4 ▶sub last_consumed_message_index { return $_[0]{properties}{last_consumed_message_index} }
Subroutine last_consumed_message_index: called CC=1 SCAR=0.0
232  
233 4 ▶sub last_consumption_timestamp {
Subroutine last_consumption_timestamp: called CC=1 SCAR=0.0
234 4 return Twilio::Deserialize::date_time($_[0]{properties}{last_consumption_timestamp});
235 }
236 4 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
237 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
238 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
239 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
240  
241 2 1;
242  
243 __END__
« Twilio/Rest/Verify/V2/Service/Entity.pm ↑ Summary Twilio/Rest/Conversations/V1/Conversation/Participant.pm »