Twilio/Rest/Conversations/V1/Service/Conversation/Participant.pm

filter: Statementstmt 85.1% 86 / 101 Branchbran n/a Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 83.3% 35 / 42 Podpod n/a totaltotal 79.3% 127 / 160 CC 6 SCAR 3.1
CC
6
Cov
82%
delete
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Taskrouter/V1/Workspace/Activity.pm ↑ Summary Twilio/Rest/Webhooks/V1/Rule.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::Service::Conversation::Participant;
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::Conversations::V1::Service::Conversation::ParticipantList;
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, $chat_service_sid, $conversation_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 $self->{solution} =
19 5 { chat_service_sid => $chat_service_sid, conversation_sid => $conversation_sid };
20 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
21 '/Conversations/', Twilio::Serialize::path_segment($conversation_sid), '/Participants';
22 5 return $self;
23 }
24  
25 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
26 1 my ($self, $options) = @_;
27 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
28  
29 my $data = {
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 Identity => $options->{identity},
34 'MessagingBinding.Address' => $options->{messaging_binding_address},
35 'MessagingBinding.ProjectedAddress' => $options->{messaging_binding_projected_address},
36 'MessagingBinding.ProxyAddress' => $options->{messaging_binding_proxy_address},
37 RoleSid => $options->{role_sid},
38 1 };
39  
40 my $response = $self->{version}->handle_request(
41 'POST',
42 $self->{uri},
43 'create',
44 {
45 data => $data,
46 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
47 }
48 1 );
49 return Twilio::Rest::Conversations::V1::Service::Conversation::ParticipantInstance->new(
50 $self->{version}, $response->get_content,
51 $self->{solution}{chat_service_sid},
52 $self->{solution}{conversation_sid}
53 1 );
54 }
55  
56 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
57 0 my ($self, @arguments) = @_;
58 0 return $self->read_records(@arguments);
59 }
60  
61 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
62 0 my ($self, @arguments) = @_;
63 0 return $self->stream_records(@arguments);
64 }
65  
66 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
67 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
68 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
69  
70 1 my $params = {
71 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::Conversations::V1::Service::Conversation::ParticipantPage->new(
89 1 $self->{version}, $response, $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::Conversations::V1::Service::Conversation::ParticipantContext->new(
95 $self->{version},
96 $self->{solution}{chat_service_sid},
97 3 $self->{solution}{conversation_sid}, $sid
98 );
99 }
100  
101 package Twilio::Rest::Conversations::V1::Service::Conversation::ParticipantPage;
102  
103 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 1 ▶sub records_key { return 'participants' }
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::Conversations::V1::Service::Conversation::ParticipantInstance->new(
110 $self->{version}, $payload,
111 $self->{solution}{chat_service_sid},
112 $self->{solution}{conversation_sid}
113 1 );
114 }
115  
116 package Twilio::Rest::Conversations::V1::Service::Conversation::ParticipantContext;
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, $chat_service_sid, $conversation_sid, $sid) = @_;
124 3 my $self = $class->SUPER::new($version);
125 $self->{solution} =
126 3 { chat_service_sid => $chat_service_sid, conversation_sid => $conversation_sid, sid => $sid };
127 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
128 '/Conversations/', Twilio::Serialize::path_segment($conversation_sid), '/Participants/',
129 Twilio::Serialize::path_segment($sid);
130 3 return $self;
131 }
132  
133 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
134 1 my ($self, $options) = @_;
135 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
136 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
137 1 { headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, } });
138 1 return 1;
139 }
140  
141 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
142 1 my ($self) = @_;
143  
144 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
145 1 return $self->_build_instance($response);
146 }
147  
148 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
149 1 my ($self, $options) = @_;
150 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
151  
152 my $data = {
153 Attributes => $options->{attributes},
154 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
155 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
156 Identity => $options->{identity},
157 LastReadMessageIndex => $options->{last_read_message_index},
158 LastReadTimestamp => $options->{last_read_timestamp},
159 'MessagingBinding.ProjectedAddress' => $options->{messaging_binding_projected_address},
160 'MessagingBinding.ProxyAddress' => $options->{messaging_binding_proxy_address},
161 RoleSid => $options->{role_sid},
162 1 };
163  
164 my $response = $self->{version}->handle_request(
165 'POST',
166 $self->{uri},
167 'update',
168 {
169 data => $data,
170 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
171 }
172 1 );
173 1 return $self->_build_instance($response);
174 }
175  
176 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
177 2 my ($self, $response) = @_;
178 return Twilio::Rest::Conversations::V1::Service::Conversation::ParticipantInstance->new(
179 $self->{version}, $response->get_content,
180 $self->{solution}{chat_service_sid},
181 $self->{solution}{conversation_sid},
182 $self->{solution}{sid}
183 2 );
184 }
185  
186 package Twilio::Rest::Conversations::V1::Service::Conversation::ParticipantInstance;
187  
188 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
189  
190 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
191  
192 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
193 4 my ($class, $version, $payload, $chat_service_sid, $conversation_sid, $sid) = @_;
194 4 my $self = $class->SUPER::new($version, $payload);
195 $self->{solution} = {
196 chat_service_sid => $chat_service_sid,
197 conversation_sid => $conversation_sid,
198 sid => $sid // $self->{properties}{sid}
199 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
200 4 return $self;
201 }
202  
203 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
204 0 my ($self, @arguments) = @_;
205 0 return $self->_context->delete(@arguments);
206 }
207  
208 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
209 0 my ($self, @arguments) = @_;
210 0 return $self->_context->fetch(@arguments);
211 }
212  
213 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
214 0 my ($self, @arguments) = @_;
215 0 return $self->_context->update(@arguments);
216 }
217  
218 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
219 0 my ($self) = @_;
220 return Twilio::Rest::Conversations::V1::Service::Conversation::ParticipantContext->new(
221 $self->{version},
222 $self->{solution}{chat_service_sid},
223 $self->{solution}{conversation_sid},
224 $self->{solution}{sid}
225 0 );
226 }
227  
228 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
229 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
230 4 ▶sub chat_service_sid { return $_[0]{properties}{chat_service_sid} }
Subroutine chat_service_sid: called CC=1 SCAR=0.0
231 4 ▶sub conversation_sid { return $_[0]{properties}{conversation_sid} }
Subroutine conversation_sid: called CC=1 SCAR=0.0
232 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
233 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
234 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
235 4 ▶sub last_read_message_index { return $_[0]{properties}{last_read_message_index} }
Subroutine last_read_message_index: called CC=1 SCAR=0.0
236 4 ▶sub last_read_timestamp { return $_[0]{properties}{last_read_timestamp} }
Subroutine last_read_timestamp: called CC=1 SCAR=0.0
237 4 ▶sub messaging_binding { return $_[0]{properties}{messaging_binding} }
Subroutine messaging_binding: called CC=1 SCAR=0.0
238 4 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
239 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
240 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
241  
242 2 1;
243  
244 __END__
« Twilio/Rest/Taskrouter/V1/Workspace/Activity.pm ↑ Summary Twilio/Rest/Webhooks/V1/Rule.pm »