Twilio/Rest/Proxy/V1/Service/Session.pm

filter: Statementstmt 83.4% 96 / 115 Branchbran 100% 4 / 4 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 81.6% 40 / 49 Podpod n/a totaltotal 79.6% 145 / 182 CC 7 SCAR 3.2
CC
7
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Studio/V1/Flow.pm ↑ Summary Twilio/Rest/Sync/V1/Service/SyncList/SyncListItem.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Proxy::V1::Service::Session;
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::Proxy::V1::Service::SessionList;
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 15 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 15 my ($class, $version, $service_sid) = @_;
17 15 my $self = $class->SUPER::new($version);
18 15 $self->{solution} = { service_sid => $service_sid };
19 15 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Sessions';
20 15 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $options) = @_;
25 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
26  
27 my $data = {
28 DateExpiry => Twilio::Serialize::iso8601_date_time($options->{date_expiry}),
29 Mode => $options->{mode},
30 Participants =>
31 Twilio::Serialize::map_values($options->{participants}, \&Twilio::Serialize::json_object),
32 Status => $options->{status},
33 Ttl => $options->{ttl},
34 UniqueName => $options->{unique_name},
35 1 };
36  
37 my $response =
38 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
39 return Twilio::Rest::Proxy::V1::Service::SessionInstance->new($self->{version},
40 1 $response->get_content, $self->{solution}{service_sid});
41 }
42  
43 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
44 0 my ($self, @arguments) = @_;
45 0 return $self->read_records(@arguments);
46 }
47  
48 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
49 0 my ($self, @arguments) = @_;
50 0 return $self->stream_records(@arguments);
51 }
52  
53 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
54 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
55 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
56  
57 1 my $params = {
58 PageToken => $page_token,
59 Page => $page_number,
60 PageSize => $page_size,
61 };
62  
63 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
64 1 return $self->_build_page($response);
65 }
66  
67 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
68 0 my ($self, $target_url) = @_;
69 0 my $client = $self->{version}->get_domain->get_client;
70 0 return $self->_build_page($client->request('GET', $target_url));
71 }
72  
73 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
74 1 my ($self, $response) = @_;
75 return Twilio::Rest::Proxy::V1::Service::SessionPage->new($self->{version}, $response,
76 1 $self->{solution});
77 }
78  
79 13 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
80 13 my ($self, $sid) = @_;
81 return Twilio::Rest::Proxy::V1::Service::SessionContext->new($self->{version},
82 13 $self->{solution}{service_sid}, $sid);
83 }
84  
85 package Twilio::Rest::Proxy::V1::Service::SessionPage;
86  
87 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
88  
89 1 ▶sub records_key { return 'sessions' }
Subroutine records_key: called CC=1 SCAR=0.0
90  
91 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
92 1 my ($self, $payload) = @_;
93 return Twilio::Rest::Proxy::V1::Service::SessionInstance->new($self->{version}, $payload,
94 1 $self->{solution}{service_sid});
95 }
96  
97 package Twilio::Rest::Proxy::V1::Service::SessionContext;
98  
99 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 13 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
104 13 my ($class, $version, $service_sid, $sid) = @_;
105 13 my $self = $class->SUPER::new($version);
106 13 $self->{solution} = { service_sid => $service_sid, sid => $sid };
107 13 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
108 '/Sessions/', Twilio::Serialize::path_segment($sid);
109 13 return $self;
110 }
111  
112 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
113 1 my ($self) = @_;
114 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
115 1 return 1;
116 }
117  
118 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
119 1 my ($self) = @_;
120  
121 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
122 1 return $self->_build_instance($response);
123 }
124  
125 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
126 1 my ($self, $options) = @_;
127 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
128  
129 my $data = {
130 DateExpiry => Twilio::Serialize::iso8601_date_time($options->{date_expiry}),
131 Status => $options->{status},
132 Ttl => $options->{ttl},
133 1 };
134  
135 my $response =
136 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
137 1 return $self->_build_instance($response);
138 }
139  
140 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
141 2 my ($self, $response) = @_;
142 return Twilio::Rest::Proxy::V1::Service::SessionInstance->new(
143 $self->{version}, $response->get_content,
144 $self->{solution}{service_sid}, $self->{solution}{sid}
145 2 );
146 }
147  
148 3 ▶sub interactions {
Subroutine interactions: called CC=2 SCAR=6.9
149 3 my ($self, $sid) = @_;
150 3 require Twilio::Rest::Proxy::V1::Service::Session::Interaction;
151 my $list = Twilio::Rest::Proxy::V1::Service::Session::InteractionList->new(
152 $self->{version},
153 $self->{solution}{service_sid},
154 $self->{solution}{sid}
155 3 );
156 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
157 }
158  
159 7 ▶sub participants {
Subroutine participants: called CC=2 SCAR=6.9
160 7 my ($self, $sid) = @_;
161 7 require Twilio::Rest::Proxy::V1::Service::Session::Participant;
162 my $list = Twilio::Rest::Proxy::V1::Service::Session::ParticipantList->new(
163 $self->{version},
164 $self->{solution}{service_sid},
165 $self->{solution}{sid}
166 7 );
167 7 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 5 2 7
168 }
169  
170 package Twilio::Rest::Proxy::V1::Service::SessionInstance;
171  
172 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
173  
174 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
175  
176 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
177 4 my ($class, $version, $payload, $service_sid, $sid) = @_;
178 4 my $self = $class->SUPER::new($version, $payload);
179 4 ▶ $self->{solution} = { service_sid => $service_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
180 4 return $self;
181 }
182  
183 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
184 0 my ($self, @arguments) = @_;
185 0 return $self->_context->delete(@arguments);
186 }
187  
188 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
189 0 my ($self, @arguments) = @_;
190 0 return $self->_context->fetch(@arguments);
191 }
192  
193 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
194 0 my ($self, @arguments) = @_;
195 0 return $self->_context->update(@arguments);
196 }
197  
198 0 ▶sub interactions {
Subroutine interactions: not called CC=1 SCAR=6.9
199 0 my ($self, @arguments) = @_;
200 0 return $self->_context->interactions(@arguments);
201 }
202  
203 0 ▶sub participants {
Subroutine participants: not called CC=1 SCAR=6.9
204 0 my ($self, @arguments) = @_;
205 0 return $self->_context->participants(@arguments);
206 }
207  
208 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
209 0 my ($self) = @_;
210 return Twilio::Rest::Proxy::V1::Service::SessionContext->new(
211 $self->{version},
212 $self->{solution}{service_sid},
213 $self->{solution}{sid}
214 0 );
215 }
216  
217 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
218 4 ▶sub closed_reason { return $_[0]{properties}{closed_reason} }
Subroutine closed_reason: called CC=1 SCAR=0.0
219 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
220 4 ▶sub date_ended { return Twilio::Deserialize::date_time($_[0]{properties}{date_ended}) }
Subroutine date_ended: called CC=1 SCAR=0.0
221 4 ▶sub date_expiry { return Twilio::Deserialize::date_time($_[0]{properties}{date_expiry}) }
Subroutine date_expiry: called CC=1 SCAR=0.0
222  
223 4 ▶sub date_last_interaction {
Subroutine date_last_interaction: called CC=1 SCAR=0.0
224 4 return Twilio::Deserialize::date_time($_[0]{properties}{date_last_interaction});
225 }
226 4 ▶sub date_started { return Twilio::Deserialize::date_time($_[0]{properties}{date_started}) }
Subroutine date_started: called CC=1 SCAR=0.0
227 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
228 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
229 4 ▶sub mode { return $_[0]{properties}{mode} }
Subroutine mode: called CC=1 SCAR=0.0
230 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
231 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
232 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
233 4 ▶sub ttl { return $_[0]{properties}{ttl} }
Subroutine ttl: called CC=1 SCAR=0.0
234 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
235 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
236  
237 2 1;
238  
239 __END__
« Twilio/Rest/Studio/V1/Flow.pm ↑ Summary Twilio/Rest/Sync/V1/Service/SyncList/SyncListItem.pm »