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

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