Twilio/Rest/Conversations/V1/Conversation/Participant.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/Chat/V2/Service/Channel/Member.pm ↑ Summary Twilio/Rest/IpMessaging/V2/Service/Channel/Member.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::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::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, $conversation_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { conversation_sid => $conversation_sid };
19 5 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_sid),
20 '/Participants';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $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 Attributes => $options->{attributes},
30 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
31 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
32 Identity => $options->{identity},
33 'MessagingBinding.Address' => $options->{messaging_binding_address},
34 'MessagingBinding.ProjectedAddress' => $options->{messaging_binding_projected_address},
35 'MessagingBinding.ProxyAddress' => $options->{messaging_binding_proxy_address},
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::Conversations::V1::Conversation::ParticipantInstance->new($self->{version},
49 1 $response->get_content, $self->{solution}{conversation_sid});
50 }
51  
52 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
53 0 my ($self, @arguments) = @_;
54 0 return $self->read_records(@arguments);
55 }
56  
57 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
58 0 my ($self, @arguments) = @_;
59 0 return $self->stream_records(@arguments);
60 }
61  
62 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
63 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
64 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
65  
66 1 my $params = {
67 PageToken => $page_token,
68 Page => $page_number,
69 PageSize => $page_size,
70 };
71  
72 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
73 1 return $self->_build_page($response);
74 }
75  
76 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
77 0 my ($self, $target_url) = @_;
78 0 my $client = $self->{version}->get_domain->get_client;
79 0 return $self->_build_page($client->request('GET', $target_url));
80 }
81  
82 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
83 1 my ($self, $response) = @_;
84 return Twilio::Rest::Conversations::V1::Conversation::ParticipantPage->new($self->{version},
85 1 $response, $self->{solution});
86 }
87  
88 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
89 3 my ($self, $sid) = @_;
90 return Twilio::Rest::Conversations::V1::Conversation::ParticipantContext->new($self->{version},
91 3 $self->{solution}{conversation_sid}, $sid);
92 }
93  
94 package Twilio::Rest::Conversations::V1::Conversation::ParticipantPage;
95  
96 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 1 ▶sub records_key { return 'participants' }
Subroutine records_key: called CC=1 SCAR=0.0
99  
100 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
101 1 my ($self, $payload) = @_;
102 return Twilio::Rest::Conversations::V1::Conversation::ParticipantInstance->new($self->{version},
103 1 $payload, $self->{solution}{conversation_sid});
104 }
105  
106 package Twilio::Rest::Conversations::V1::Conversation::ParticipantContext;
107  
108 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
109  
110 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
111  
112 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
113 3 my ($class, $version, $conversation_sid, $sid) = @_;
114 3 my $self = $class->SUPER::new($version);
115 3 $self->{solution} = { conversation_sid => $conversation_sid, sid => $sid };
116 3 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_sid),
117 '/Participants/', Twilio::Serialize::path_segment($sid);
118 3 return $self;
119 }
120  
121 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
122 1 my ($self, $options) = @_;
123 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
124 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
125 1 { headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, } });
126 1 return 1;
127 }
128  
129 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
130 1 my ($self) = @_;
131  
132 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
133 1 return $self->_build_instance($response);
134 }
135  
136 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
137 1 my ($self, $options) = @_;
138 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
139  
140 my $data = {
141 Attributes => $options->{attributes},
142 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
143 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
144 Identity => $options->{identity},
145 LastReadMessageIndex => $options->{last_read_message_index},
146 LastReadTimestamp => $options->{last_read_timestamp},
147 'MessagingBinding.ProjectedAddress' => $options->{messaging_binding_projected_address},
148 'MessagingBinding.ProxyAddress' => $options->{messaging_binding_proxy_address},
149 RoleSid => $options->{role_sid},
150 1 };
151  
152 my $response = $self->{version}->handle_request(
153 'POST',
154 $self->{uri},
155 'update',
156 {
157 data => $data,
158 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
159 }
160 1 );
161 1 return $self->_build_instance($response);
162 }
163  
164 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
165 2 my ($self, $response) = @_;
166 return Twilio::Rest::Conversations::V1::Conversation::ParticipantInstance->new(
167 $self->{version}, $response->get_content,
168 $self->{solution}{conversation_sid},
169 $self->{solution}{sid}
170 2 );
171 }
172  
173 package Twilio::Rest::Conversations::V1::Conversation::ParticipantInstance;
174  
175 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
176  
177 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
178  
179 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
180 4 my ($class, $version, $payload, $conversation_sid, $sid) = @_;
181 4 my $self = $class->SUPER::new($version, $payload);
182 $self->{solution} =
183 4 ▶ { conversation_sid => $conversation_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
184 4 return $self;
185 }
186  
187 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
188 0 my ($self, @arguments) = @_;
189 0 return $self->_context->delete(@arguments);
190 }
191  
192 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->fetch(@arguments);
195 }
196  
197 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
198 0 my ($self, @arguments) = @_;
199 0 return $self->_context->update(@arguments);
200 }
201  
202 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
203 0 my ($self) = @_;
204 return Twilio::Rest::Conversations::V1::Conversation::ParticipantContext->new(
205 $self->{version},
206 $self->{solution}{conversation_sid},
207 $self->{solution}{sid}
208 0 );
209 }
210  
211 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
212 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
213 4 ▶sub conversation_sid { return $_[0]{properties}{conversation_sid} }
Subroutine conversation_sid: called CC=1 SCAR=0.0
214 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
215 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
216 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
217 4 ▶sub last_read_message_index { return $_[0]{properties}{last_read_message_index} }
Subroutine last_read_message_index: called CC=1 SCAR=0.0
218 4 ▶sub last_read_timestamp { return $_[0]{properties}{last_read_timestamp} }
Subroutine last_read_timestamp: called CC=1 SCAR=0.0
219 4 ▶sub messaging_binding { return $_[0]{properties}{messaging_binding} }
Subroutine messaging_binding: called CC=1 SCAR=0.0
220 4 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
221 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
222 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
223  
224 2 1;
225  
226 __END__
« Twilio/Rest/Chat/V2/Service/Channel/Member.pm ↑ Summary Twilio/Rest/IpMessaging/V2/Service/Channel/Member.pm »