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

filter: Statementstmt 84.5% 93 / 110 Branchbran 100% 2 / 2 Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 82.9% 39 / 47 Podpod n/a totaltotal 79.5% 140 / 176 CC 7 SCAR 3.2
CC
7
Cov
82%
delete
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Sync/V1/Service/Document.pm ↑ Summary Twilio/Rest/Studio/V1/Flow.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::Message;
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::MessageList;
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 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 7 my ($class, $version, $chat_service_sid, $conversation_sid) = @_;
17 7 my $self = $class->SUPER::new($version);
18 $self->{solution} =
19 7 { chat_service_sid => $chat_service_sid, conversation_sid => $conversation_sid };
20 7 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
21 '/Conversations/', Twilio::Serialize::path_segment($conversation_sid), '/Messages';
22 7 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 Author => $options->{author},
32 Body => $options->{body},
33 ContentSid => $options->{content_sid},
34 ContentVariables => $options->{content_variables},
35 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
36 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
37 MediaSid => $options->{media_sid},
38 Subject => $options->{subject},
39 1 };
40  
41 my $response = $self->{version}->handle_request(
42 'POST',
43 $self->{uri},
44 'create',
45 {
46 data => $data,
47 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
48 }
49 1 );
50 return Twilio::Rest::Conversations::V1::Service::Conversation::MessageInstance->new(
51 $self->{version}, $response->get_content,
52 $self->{solution}{chat_service_sid},
53 $self->{solution}{conversation_sid}
54 1 );
55 }
56  
57 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
58 0 my ($self, @arguments) = @_;
59 0 return $self->read_records(@arguments);
60 }
61  
62 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
63 0 my ($self, @arguments) = @_;
64 0 return $self->stream_records(@arguments);
65 }
66  
67 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
68 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
69 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
70  
71 my $params = {
72 Order => $options->{order},
73 1 PageToken => $page_token,
74 Page => $page_number,
75 PageSize => $page_size,
76 };
77  
78 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
79 1 return $self->_build_page($response);
80 }
81  
82 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
83 0 my ($self, $target_url) = @_;
84 0 my $client = $self->{version}->get_domain->get_client;
85 0 return $self->_build_page($client->request('GET', $target_url));
86 }
87  
88 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
89 1 my ($self, $response) = @_;
90 return Twilio::Rest::Conversations::V1::Service::Conversation::MessagePage->new($self->{version},
91 1 $response, $self->{solution});
92 }
93  
94 5 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
95 5 my ($self, $sid) = @_;
96 return Twilio::Rest::Conversations::V1::Service::Conversation::MessageContext->new(
97 $self->{version},
98 $self->{solution}{chat_service_sid},
99 5 $self->{solution}{conversation_sid}, $sid
100 );
101 }
102  
103 package Twilio::Rest::Conversations::V1::Service::Conversation::MessagePage;
104  
105 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 1 ▶sub records_key { return 'messages' }
Subroutine records_key: called CC=1 SCAR=0.0
108  
109 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
110 1 my ($self, $payload) = @_;
111 return Twilio::Rest::Conversations::V1::Service::Conversation::MessageInstance->new(
112 $self->{version}, $payload,
113 $self->{solution}{chat_service_sid},
114 $self->{solution}{conversation_sid}
115 1 );
116 }
117  
118 package Twilio::Rest::Conversations::V1::Service::Conversation::MessageContext;
119  
120 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
121  
122 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
123  
124 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
125 5 my ($class, $version, $chat_service_sid, $conversation_sid, $sid) = @_;
126 5 my $self = $class->SUPER::new($version);
127 $self->{solution} =
128 5 { chat_service_sid => $chat_service_sid, conversation_sid => $conversation_sid, sid => $sid };
129 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
130 '/Conversations/', Twilio::Serialize::path_segment($conversation_sid), '/Messages/',
131 Twilio::Serialize::path_segment($sid);
132 5 return $self;
133 }
134  
135 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
136 1 my ($self, $options) = @_;
137 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
138 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
139 1 { headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, } });
140 1 return 1;
141 }
142  
143 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
144 1 my ($self) = @_;
145  
146 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
147 1 return $self->_build_instance($response);
148 }
149  
150 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
151 1 my ($self, $options) = @_;
152 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
153  
154 my $data = {
155 Attributes => $options->{attributes},
156 Author => $options->{author},
157 Body => $options->{body},
158 DateCreated => Twilio::Serialize::iso8601_date_time($options->{date_created}),
159 DateUpdated => Twilio::Serialize::iso8601_date_time($options->{date_updated}),
160 Subject => $options->{subject},
161 1 };
162  
163 my $response = $self->{version}->handle_request(
164 'POST',
165 $self->{uri},
166 'update',
167 {
168 data => $data,
169 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
170 }
171 1 );
172 1 return $self->_build_instance($response);
173 }
174  
175 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
176 2 my ($self, $response) = @_;
177 return Twilio::Rest::Conversations::V1::Service::Conversation::MessageInstance->new(
178 $self->{version}, $response->get_content,
179 $self->{solution}{chat_service_sid},
180 $self->{solution}{conversation_sid},
181 $self->{solution}{sid}
182 2 );
183 }
184  
185 2 ▶sub delivery_receipts {
Subroutine delivery_receipts: called CC=2 SCAR=6.9
186 2 my ($self, $sid) = @_;
187 2 require Twilio::Rest::Conversations::V1::Service::Conversation::Message::DeliveryReceipt;
188 my $list =
189 Twilio::Rest::Conversations::V1::Service::Conversation::Message::DeliveryReceiptList->new(
190 $self->{version},
191 $self->{solution}{chat_service_sid},
192 $self->{solution}{conversation_sid},
193 $self->{solution}{sid}
194 2 );
195 2 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 1 2
196 }
197  
198 package Twilio::Rest::Conversations::V1::Service::Conversation::MessageInstance;
199  
200 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
201  
202 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
203  
204 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
205 4 my ($class, $version, $payload, $chat_service_sid, $conversation_sid, $sid) = @_;
206 4 my $self = $class->SUPER::new($version, $payload);
207 $self->{solution} = {
208 chat_service_sid => $chat_service_sid,
209 conversation_sid => $conversation_sid,
210 sid => $sid // $self->{properties}{sid}
211 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
212 4 return $self;
213 }
214  
215 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
216 0 my ($self, @arguments) = @_;
217 0 return $self->_context->delete(@arguments);
218 }
219  
220 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
221 0 my ($self, @arguments) = @_;
222 0 return $self->_context->fetch(@arguments);
223 }
224  
225 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
226 0 my ($self, @arguments) = @_;
227 0 return $self->_context->update(@arguments);
228 }
229  
230 0 ▶sub delivery_receipts {
Subroutine delivery_receipts: not called CC=1 SCAR=6.9
231 0 my ($self, @arguments) = @_;
232 0 return $self->_context->delivery_receipts(@arguments);
233 }
234  
235 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
236 0 my ($self) = @_;
237 return Twilio::Rest::Conversations::V1::Service::Conversation::MessageContext->new(
238 $self->{version},
239 $self->{solution}{chat_service_sid},
240 $self->{solution}{conversation_sid},
241 $self->{solution}{sid}
242 0 );
243 }
244  
245 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
246 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
247 4 ▶sub author { return $_[0]{properties}{author} }
Subroutine author: called CC=1 SCAR=0.0
248 4 ▶sub body { return $_[0]{properties}{body} }
Subroutine body: called CC=1 SCAR=0.0
249 4 ▶sub chat_service_sid { return $_[0]{properties}{chat_service_sid} }
Subroutine chat_service_sid: called CC=1 SCAR=0.0
250 4 ▶sub content_sid { return $_[0]{properties}{content_sid} }
Subroutine content_sid: called CC=1 SCAR=0.0
251 4 ▶sub conversation_sid { return $_[0]{properties}{conversation_sid} }
Subroutine conversation_sid: called CC=1 SCAR=0.0
252 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
253 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
254 4 ▶sub delivery { return $_[0]{properties}{delivery} }
Subroutine delivery: called CC=1 SCAR=0.0
255 4 ▶sub index { return $_[0]{properties}{index} }
Subroutine index: called CC=1 SCAR=0.0
256 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
257 4 ▶sub media { return $_[0]{properties}{media} }
Subroutine media: called CC=1 SCAR=0.0
258 4 ▶sub participant_sid { return $_[0]{properties}{participant_sid} }
Subroutine participant_sid: called CC=1 SCAR=0.0
259 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
260 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
261  
262 2 1;
263  
264 __END__
« Twilio/Rest/Sync/V1/Service/Document.pm ↑ Summary Twilio/Rest/Studio/V1/Flow.pm »