Twilio/Rest/Conversations/V2/Conversation.pm

filter: Statementstmt 84.6% 94 / 111 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 82.6% 38 / 46 Podpod n/a totaltotal 80.9% 136 / 168 CC 4 SCAR 2.5
CC
4
Cov
83%
delete
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtension.pm ↑ Summary Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignment.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V2::Conversation;
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::V2::ConversationList;
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 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 6 my ($class, $version) = @_;
17 6 my $self = $class->SUPER::new($version);
18 6 $self->{solution} = {};
19 6 $self->{uri} = '/Conversations';
20 6 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 1 my ($self, $body) = @_;
25  
26 1 my $data = Twilio::Serialize::json_body($body, {});
27  
28 my $response = $self->{version}->handle_request(
29 'POST',
30 $self->{uri},
31 1 'create',
32 {
33 data => $data,
34 headers => { 'Content-Type' => 'application/json', }
35 }
36 );
37 return Twilio::Rest::Conversations::V2::ConversationInstance->new($self->{version},
38 1 $response->get_content);
39 }
40  
41 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
42 0 my ($self, @arguments) = @_;
43 0 return $self->read_records(@arguments);
44 }
45  
46 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
47 0 my ($self, @arguments) = @_;
48 0 return $self->stream_records(@arguments);
49 }
50  
51 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
52 1 my ($self, $options, $page_size, $page_token) = @_;
53 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
54  
55 my $params = {
56 channelId => $options->{channel_id},
57 status => $options->{status},
58 1 pageSize => $page_size,
59 pageToken => $page_token,
60 };
61  
62 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
63 1 return $self->_build_page($response);
64 }
65  
66 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
67 0 my ($self, $target_url) = @_;
68 0 my $client = $self->{version}->get_domain->get_client;
69 0 return $self->_build_page($client->request('GET', $target_url));
70 }
71  
72 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
73 1 my ($self, $response) = @_;
74 return Twilio::Rest::Conversations::V2::ConversationPage->new($self->{version}, $response,
75 1 $self->{solution});
76 }
77  
78 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
79 4 my ($self, $id) = @_;
80 4 return Twilio::Rest::Conversations::V2::ConversationContext->new($self->{version}, $id);
81 }
82  
83 package Twilio::Rest::Conversations::V2::ConversationPage;
84  
85 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'conversations' }
Subroutine records_key: called CC=1 SCAR=0.0
88  
89 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
90 1 my ($self, $payload) = @_;
91 1 return Twilio::Rest::Conversations::V2::ConversationInstance->new($self->{version}, $payload);
92 }
93  
94 package Twilio::Rest::Conversations::V2::ConversationContext;
95  
96 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
101 4 my ($class, $version, $id) = @_;
102 4 my $self = $class->SUPER::new($version);
103 4 $self->{solution} = { id => $id };
104 4 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($id);
105 4 return $self;
106 }
107  
108 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
109 1 my ($self, $options) = @_;
110 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
111 my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
112 1 { headers => { 'Idempotency-Key' => $options->{idempotency_key}, } });
113 return Twilio::Rest::Conversations::V2::DeleteConversationAsync202ResponseInstance->new(
114 1 $self->{version}, $response->get_content);
115 }
116  
117 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
118 1 my ($self) = @_;
119  
120 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
121 1 return $self->_build_instance($response);
122 }
123  
124 1 ▶sub patch {
Subroutine patch: called CC=1 SCAR=0.0
125 1 my ($self, $body) = @_;
126  
127 1 my $data = Twilio::Serialize::json_body($body, {});
128  
129 my $response = $self->{version}->handle_request(
130 'PATCH',
131 $self->{uri},
132 1 'patch',
133 {
134 data => $data,
135 headers => { 'Content-Type' => 'application/json', }
136 }
137 );
138 1 return $self->_build_instance($response);
139 }
140  
141 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
142 1 my ($self, $body) = @_;
143  
144 1 my $data = Twilio::Serialize::json_body($body, {});
145  
146 my $response = $self->{version}->handle_request(
147 'PUT',
148 $self->{uri},
149 1 'update',
150 {
151 data => $data,
152 headers => { 'Content-Type' => 'application/json', }
153 }
154 );
155 1 return $self->_build_instance($response);
156 }
157  
158 3 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
159 3 my ($self, $response) = @_;
160 return Twilio::Rest::Conversations::V2::ConversationInstance->new($self->{version},
161 3 $response->get_content, $self->{solution}{id});
162 }
163  
164 package Twilio::Rest::Conversations::V2::ConversationInstance;
165  
166 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
167  
168 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
169  
170 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
171 5 my ($class, $version, $payload, $id) = @_;
172 5 my $self = $class->SUPER::new($version, $payload);
173 5 ▶ $self->{solution} = { id => $id // $self->{properties}{id} };
Condition66%2/3
$id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
320
MC/DC0%0/2
$id // $self->{"properties"}{"id"}
$id $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
174 5 return $self;
175 }
176  
177 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->delete(@arguments);
180 }
181  
182 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->fetch(@arguments);
185 }
186  
187 0 ▶sub patch {
Subroutine patch: not called CC=1 SCAR=6.9
188 0 my ($self, @arguments) = @_;
189 0 return $self->_context->patch(@arguments);
190 }
191  
192 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->update(@arguments);
195 }
196  
197 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
198 0 my ($self) = @_;
199 return Twilio::Rest::Conversations::V2::ConversationContext->new($self->{version},
200 0 $self->{solution}{id});
201 }
202  
203 5 ▶sub account_id { return $_[0]{properties}{accountId} }
Subroutine account_id: called CC=1 SCAR=0.0
204 5 ▶sub action_id { return $_[0]{properties}{actionId} }
Subroutine action_id: called CC=1 SCAR=0.0
205 5 ▶sub configuration { return $_[0]{properties}{configuration} }
Subroutine configuration: called CC=1 SCAR=0.0
206 5 ▶sub configuration_id { return $_[0]{properties}{configurationId} }
Subroutine configuration_id: called CC=1 SCAR=0.0
207 5 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
208 5 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
209 5 ▶sub metadata { return $_[0]{properties}{metadata} }
Subroutine metadata: called CC=1 SCAR=0.0
210 5 ▶sub name { return $_[0]{properties}{name} }
Subroutine name: called CC=1 SCAR=0.0
211 5 ▶sub participants { return $_[0]{properties}{participants} }
Subroutine participants: called CC=1 SCAR=0.0
212 5 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
213 5 ▶sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) }
Subroutine updated_at: called CC=1 SCAR=0.0
214  
215 package Twilio::Rest::Conversations::V2::DeleteConversationAsync202ResponseInstance;
216  
217 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
218  
219 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
220  
221 1 ▶sub related { return $_[0]{properties}{related} }
Subroutine related: called CC=1 SCAR=0.0
222 1 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
223  
224 2 1;
225  
226 __END__
« Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtension.pm ↑ Summary Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignment.pm »