Twilio/Rest/FlexApi/V1/Interaction/InteractionChannel.pm

filter: Statementstmt 81.3% 83 / 102 Branchbran 100% 4 / 4 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 77.5% 31 / 40 Podpod n/a totaltotal 77.7% 122 / 157 CC 6 SCAR 3.5
CC
6
Cov
81%
page
2.0
update
2.0
new
2.0
CRAP 1.4
« Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle.pm ↑ Summary Twilio/Rest/Voice/V1/ConnectionPolicy.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel;
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::FlexApi::V1::Interaction::InteractionChannelList;
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 11 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 11 my ($class, $version, $interaction_sid) = @_;
17 11 my $self = $class->SUPER::new($version);
18 11 $self->{solution} = { interaction_sid => $interaction_sid };
19 11 $self->{uri} = join q{}, '/Interactions/', Twilio::Serialize::path_segment($interaction_sid),
20 '/Channels';
21 11 return $self;
22 }
23  
24 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
25 0 my ($self, @arguments) = @_;
26 0 return $self->read_records(@arguments);
27 }
28  
29 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
30 0 my ($self, @arguments) = @_;
31 0 return $self->stream_records(@arguments);
32 }
33  
34 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
35 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
36 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
37  
38 1 my $params = {
39 PageToken => $page_token,
40 Page => $page_number,
41 PageSize => $page_size,
42 };
43  
44 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
45 1 return $self->_build_page($response);
46 }
47  
48 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
49 0 my ($self, $target_url) = @_;
50 0 my $client = $self->{version}->get_domain->get_client;
51 0 return $self->_build_page($client->request('GET', $target_url));
52 }
53  
54 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
55 1 my ($self, $response) = @_;
56 return Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelPage->new($self->{version},
57 1 $response, $self->{solution});
58 }
59  
60 10 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
61 10 my ($self, $sid) = @_;
62 return Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelContext->new($self->{version},
63 10 $self->{solution}{interaction_sid}, $sid);
64 }
65  
66 package Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelPage;
67  
68 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
69  
70 1 ▶sub records_key { return 'channels' }
Subroutine records_key: called CC=1 SCAR=0.0
71  
72 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
73 1 my ($self, $payload) = @_;
74 return Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelInstance->new($self->{version},
75 1 $payload, $self->{solution}{interaction_sid});
76 }
77  
78 package Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelContext;
79  
80 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
81  
82 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
83  
84 10 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
85 10 my ($class, $version, $interaction_sid, $sid) = @_;
86 10 my $self = $class->SUPER::new($version);
87 10 $self->{solution} = { interaction_sid => $interaction_sid, sid => $sid };
88 10 $self->{uri} = join q{}, '/Interactions/', Twilio::Serialize::path_segment($interaction_sid),
89 '/Channels/', Twilio::Serialize::path_segment($sid);
90 10 return $self;
91 }
92  
93 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
94 1 my ($self) = @_;
95  
96 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
97 1 return $self->_build_instance($response);
98 }
99  
100 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
101 1 my ($self, $status, $options) = @_;
102 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
103  
104 my $data = {
105 Status => $status,
106 1 Routing => Twilio::Serialize::json_object($options->{routing}),
107 };
108  
109 my $response =
110 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
111 1 return $self->_build_instance($response);
112 }
113  
114 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
115 2 my ($self, $response) = @_;
116 return Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelInstance->new(
117 $self->{version}, $response->get_content,
118 $self->{solution}{interaction_sid}, $self->{solution}{sid}
119 2 );
120 }
121  
122 2 ▶sub invites {
Subroutine invites: called CC=1 SCAR=0.0
123 2 my ($self) = @_;
124 2 require Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel::InteractionChannelInvite;
125 return
126 Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel::InteractionChannelInviteList->new(
127 $self->{version},
128 $self->{solution}{interaction_sid},
129 $self->{solution}{sid}
130 2 );
131 }
132  
133 3 ▶sub participants {
Subroutine participants: called CC=2 SCAR=6.9
134 3 my ($self, $sid) = @_;
135 3 require Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel::InteractionChannelParticipant;
136 my $list =
137 Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel::InteractionChannelParticipantList
138 ->new(
139 $self->{version},
140 $self->{solution}{interaction_sid},
141 $self->{solution}{sid}
142 3 );
143 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 2 3
144 }
145  
146 3 ▶sub transfers {
Subroutine transfers: called CC=2 SCAR=6.9
147 3 my ($self, $sid) = @_;
148 3 require Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel::InteractionTransfer;
149 my $list =
150 Twilio::Rest::FlexApi::V1::Interaction::InteractionChannel::InteractionTransferList->new(
151 $self->{version},
152 $self->{solution}{interaction_sid},
153 $self->{solution}{sid}
154 3 );
155 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
156 }
157  
158 package Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelInstance;
159  
160 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
161  
162 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
163  
164 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
165 3 my ($class, $version, $payload, $interaction_sid, $sid) = @_;
166 3 my $self = $class->SUPER::new($version, $payload);
167 $self->{solution} =
168 3 ▶ { interaction_sid => $interaction_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
210
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
169 3 return $self;
170 }
171  
172 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
173 0 my ($self, @arguments) = @_;
174 0 return $self->_context->fetch(@arguments);
175 }
176  
177 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->update(@arguments);
180 }
181  
182 0 ▶sub invites {
Subroutine invites: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->invites(@arguments);
185 }
186  
187 0 ▶sub participants {
Subroutine participants: not called CC=1 SCAR=6.9
188 0 my ($self, @arguments) = @_;
189 0 return $self->_context->participants(@arguments);
190 }
191  
192 0 ▶sub transfers {
Subroutine transfers: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->transfers(@arguments);
195 }
196  
197 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
198 0 my ($self) = @_;
199 return Twilio::Rest::FlexApi::V1::Interaction::InteractionChannelContext->new(
200 $self->{version},
201 $self->{solution}{interaction_sid},
202 $self->{solution}{sid}
203 0 );
204 }
205  
206 3 ▶sub error_code { return $_[0]{properties}{error_code} }
Subroutine error_code: called CC=1 SCAR=0.0
207 3 ▶sub error_message { return $_[0]{properties}{error_message} }
Subroutine error_message: called CC=1 SCAR=0.0
208 3 ▶sub interaction_sid { return $_[0]{properties}{interaction_sid} }
Subroutine interaction_sid: called CC=1 SCAR=0.0
209 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
210 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
211 3 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
212 3 ▶sub type { return $_[0]{properties}{type} }
Subroutine type: called CC=1 SCAR=0.0
213 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
214  
215 2 1;
216  
217 __END__
« Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle.pm ↑ Summary Twilio/Rest/Voice/V1/ConnectionPolicy.pm »