Twilio/Rest/Memory/V1/ConversationSummary.pm

filter: Statementstmt 88.2% 113 / 128 Branchbran 100% 6 / 6 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.7% 42 / 49 Podpod n/a totaltotal 85.0% 165 / 194 CC 7 SCAR 3.2
CC
7
Cov
87%
create
3.0
page
2.0
new
2.0
CRAP 1.4
« Twilio/Rest/FlexApi/V1/Interaction.pm ↑ Summary Twilio/Rest/Memory/V1/Observation.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Memory::V1::ConversationSummary;
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::Memory::V1::ConversationSummaryList;
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 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 8 my ($class, $version, $store_id, $profile_id) = @_;
17 8 my $self = $class->SUPER::new($version);
18 8 $self->{solution} = { store_id => $store_id, profile_id => $profile_id };
19 8 $self->{uri} = join q{}, '/Stores/', Twilio::Serialize::path_segment($store_id), '/Profiles/',
20 Twilio::Serialize::path_segment($profile_id), '/ConversationSummaries';
21 8 return $self;
22 }
23  
24 2 ▶sub create {
Subroutine create: called CC=3 SCAR=11.0
25 2 my ($self, $body, $options) = @_;
26 2 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
20
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
27  
28 2 my $data = Twilio::Serialize::json_body($body, {});
29  
30 my $response = $self->{version}->handle_request(
31 'POST',
32 $self->{uri},
33 'create',
34 {
35 data => $data,
36 headers => {
37 'Content-Type' => 'application/json',
38 'Accept-Encoding' => $options->{accept_encoding},
39 'Content-Encoding' => $options->{content_encoding},
40 }
41 }
42 2 );
43 2 my $status = $response->get_status_code;
44 return Twilio::Rest::Memory::V1::CreateProfileConversationSummary308ResponseInstance->new(
45 2 ▶ $self->{version}, $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 308 1 1 2
46 if $status == 308;
47 return Twilio::Rest::Memory::V1::SummariesCreatedResponseInstance->new($self->{version},
48 1 $response->get_content);
49 }
50  
51 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
52 0 my ($self, @arguments) = @_;
53 0 return $self->read_records(@arguments);
54 }
55  
56 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
57 0 my ($self, @arguments) = @_;
58 0 return $self->stream_records(@arguments);
59 }
60  
61 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
62 1 my ($self, $options, $page_size, $page_token) = @_;
63 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
64  
65 my $params = {
66 conversationId => $options->{conversation_id},
67 1 pageSize => $page_size,
68 pageToken => $page_token,
69 };
70  
71 my $response = $self->{version}->page(
72 'GET',
73 $self->{uri},
74 {
75 params => $params,
76 headers => { 'Accept-Encoding' => $options->{accept_encoding}, }
77 }
78 1 );
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::Memory::V1::ConversationSummaryPage->new($self->{version}, $response,
91 1 $self->{solution});
92 }
93  
94 5 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
95 5 my ($self, $summary_id) = @_;
96 return Twilio::Rest::Memory::V1::ConversationSummaryContext->new(
97 $self->{version},
98 $self->{solution}{store_id},
99 5 $self->{solution}{profile_id}, $summary_id
100 );
101 }
102  
103 package Twilio::Rest::Memory::V1::ConversationSummaryPage;
104  
105 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 1 ▶sub records_key { return 'summaries' }
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::Memory::V1::ConversationSummaryInstance->new(
112 $self->{version}, $payload,
113 $self->{solution}{store_id},
114 $self->{solution}{profile_id}
115 1 );
116 }
117  
118 package Twilio::Rest::Memory::V1::ConversationSummaryContext;
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, $store_id, $profile_id, $summary_id) = @_;
126 5 my $self = $class->SUPER::new($version);
127 $self->{solution} =
128 5 { store_id => $store_id, profile_id => $profile_id, summary_id => $summary_id };
129 5 $self->{uri} = join q{}, '/Stores/', Twilio::Serialize::path_segment($store_id), '/Profiles/',
130 Twilio::Serialize::path_segment($profile_id), '/ConversationSummaries/',
131 Twilio::Serialize::path_segment($summary_id);
132 5 return $self;
133 }
134  
135 2 ▶sub delete {
Subroutine delete: called CC=2 SCAR=6.9
136 2 my ($self) = @_;
137 2 my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
138 2 my $status = $response->get_status_code;
139 return Twilio::Rest::Memory::V1::CreateProfileConversationSummary308ResponseInstance->new(
140 2 ▶ $self->{version}, $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 308 1 1 2
141 if $status == 308;
142 return Twilio::Rest::Memory::V1::DeleteProfileConversationSummary202ResponseInstance->new(
143 1 $self->{version}, $response->get_content);
144 }
145  
146 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
147 1 my ($self) = @_;
148  
149 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
150 1 return $self->_build_instance($response);
151 }
152  
153 2 ▶sub patch {
Subroutine patch: called CC=2 SCAR=6.9
154 2 my ($self, $body) = @_;
155  
156 2 my $data = Twilio::Serialize::json_body($body, { 'occurredAt' => 'iso8601_date_time' });
157  
158 my $response = $self->{version}->handle_request(
159 'PATCH',
160 $self->{uri},
161 2 'patch',
162 {
163 data => $data,
164 headers => { 'Content-Type' => 'application/json', }
165 }
166 );
167 2 my $status = $response->get_status_code;
168 return Twilio::Rest::Memory::V1::CreateProfileConversationSummary308ResponseInstance->new(
169 2 ▶ $self->{version}, $response->get_content)
Branch: 1 branch
BranchTrueFalseTotal
if $status == 308 1 1 2
170 if $status == 308;
171 return Twilio::Rest::Memory::V1::PatchProfileConversationSummary202ResponseInstance->new(
172 1 $self->{version}, $response->get_content);
173 }
174  
175 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
176 1 my ($self, $response) = @_;
177 return Twilio::Rest::Memory::V1::ConversationSummaryInstance->new(
178 $self->{version}, $response->get_content, $self->{solution}{store_id},
179 $self->{solution}{profile_id}, $self->{solution}{summary_id}
180 1 );
181 }
182  
183 package Twilio::Rest::Memory::V1::ConversationSummaryInstance;
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 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
190 2 my ($class, $version, $payload, $store_id, $profile_id, $summary_id) = @_;
191 2 my $self = $class->SUPER::new($version, $payload);
192 $self->{solution} = {
193 store_id => $store_id,
194 profile_id => $profile_id,
195 summary_id => $summary_id // $self->{properties}{id}
196 2 ▶ };
Condition66%2/3
$summary_id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$summary_id // $self->{"properties"}{"id"}
$summary_id $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $summary_idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
197 2 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 patch {
Subroutine patch: not called CC=1 SCAR=6.9
211 0 my ($self, @arguments) = @_;
212 0 return $self->_context->patch(@arguments);
213 }
214  
215 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
216 0 my ($self) = @_;
217 return Twilio::Rest::Memory::V1::ConversationSummaryContext->new(
218 $self->{version}, $self->{solution}{store_id},
219 $self->{solution}{profile_id}, $self->{solution}{summary_id}
220 0 );
221 }
222  
223 2 ▶sub content { return $_[0]{properties}{content} }
Subroutine content: called CC=1 SCAR=0.0
224 2 ▶sub conversation_id { return $_[0]{properties}{conversationId} }
Subroutine conversation_id: called CC=1 SCAR=0.0
225 2 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
226 2 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
227 2 ▶sub occurred_at { return Twilio::Deserialize::date_time($_[0]{properties}{occurredAt}) }
Subroutine occurred_at: called CC=1 SCAR=0.0
228 2 ▶sub source { return $_[0]{properties}{source} }
Subroutine source: called CC=1 SCAR=0.0
229 2 ▶sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) }
Subroutine updated_at: called CC=1 SCAR=0.0
230  
231 package Twilio::Rest::Memory::V1::SummariesCreatedResponseInstance;
232  
233 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
234  
235 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
236  
237 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
238  
239 package Twilio::Rest::Memory::V1::CreateProfileConversationSummary308ResponseInstance;
240  
241 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
242  
243 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
244  
245 3 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
246 3 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
247  
248 package Twilio::Rest::Memory::V1::PatchProfileConversationSummary202ResponseInstance;
249  
250 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
251  
252 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
253  
254 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
255  
256 package Twilio::Rest::Memory::V1::DeleteProfileConversationSummary202ResponseInstance;
257  
258 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
259  
260 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
261  
262 1 ▶sub message { return $_[0]{properties}{message} }
Subroutine message: called CC=1 SCAR=0.0
263  
264 2 1;
265  
266 __END__
« Twilio/Rest/FlexApi/V1/Interaction.pm ↑ Summary Twilio/Rest/Memory/V1/Observation.pm »