Twilio/Rest/Studio/V1/Flow/Engagement.pm

filter: Statementstmt 83.3% 85 / 102 Branchbran 100% 2 / 2 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.9% 34 / 42 Podpod n/a totaltotal 79.6% 125 / 157 CC 5 SCAR 3.0
CC
5
Cov
82%
create
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Trusthub/V1/SupportingDocument.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Sip/Domain.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Studio::V1::Flow::Engagement;
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::Studio::V1::Flow::EngagementList;
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, $flow_sid) = @_;
17 8 my $self = $class->SUPER::new($version);
18 8 $self->{solution} = { flow_sid => $flow_sid };
19 8 $self->{uri} = join q{}, '/Flows/', Twilio::Serialize::path_segment($flow_sid), '/Engagements';
20 8 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $to, $from, $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 To => $to,
29 From => $from,
30 1 Parameters => Twilio::Serialize::json_object($options->{parameters}),
31 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Studio::V1::Flow::EngagementInstance->new($self->{version},
36 1 $response->get_content, $self->{solution}{flow_sid});
37 }
38  
39 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->read_records(@arguments);
42 }
43  
44 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
45 0 my ($self, @arguments) = @_;
46 0 return $self->stream_records(@arguments);
47 }
48  
49 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
50 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
51 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
52  
53 1 my $params = {
54 PageToken => $page_token,
55 Page => $page_number,
56 PageSize => $page_size,
57 };
58  
59 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
60 1 return $self->_build_page($response);
61 }
62  
63 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
64 0 my ($self, $target_url) = @_;
65 0 my $client = $self->{version}->get_domain->get_client;
66 0 return $self->_build_page($client->request('GET', $target_url));
67 }
68  
69 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
70 1 my ($self, $response) = @_;
71 return Twilio::Rest::Studio::V1::Flow::EngagementPage->new($self->{version}, $response,
72 1 $self->{solution});
73 }
74  
75 6 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
76 6 my ($self, $sid) = @_;
77 return Twilio::Rest::Studio::V1::Flow::EngagementContext->new($self->{version},
78 6 $self->{solution}{flow_sid}, $sid);
79 }
80  
81 package Twilio::Rest::Studio::V1::Flow::EngagementPage;
82  
83 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 1 ▶sub records_key { return 'engagements' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 1 my ($self, $payload) = @_;
89 return Twilio::Rest::Studio::V1::Flow::EngagementInstance->new($self->{version}, $payload,
90 1 $self->{solution}{flow_sid});
91 }
92  
93 package Twilio::Rest::Studio::V1::Flow::EngagementContext;
94  
95 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
100 6 my ($class, $version, $flow_sid, $sid) = @_;
101 6 my $self = $class->SUPER::new($version);
102 6 $self->{solution} = { flow_sid => $flow_sid, sid => $sid };
103 6 $self->{uri} = join q{}, '/Flows/', Twilio::Serialize::path_segment($flow_sid), '/Engagements/',
104 Twilio::Serialize::path_segment($sid);
105 6 return $self;
106 }
107  
108 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
109 1 my ($self) = @_;
110 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
111 1 return 1;
112 }
113  
114 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
115 1 my ($self) = @_;
116  
117 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
118 1 return $self->_build_instance($response);
119 }
120  
121 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
122 1 my ($self, $response) = @_;
123 return Twilio::Rest::Studio::V1::Flow::EngagementInstance->new(
124 $self->{version}, $response->get_content,
125 $self->{solution}{flow_sid}, $self->{solution}{sid}
126 1 );
127 }
128  
129 1 ▶sub engagement_context {
Subroutine engagement_context: called CC=1 SCAR=0.0
130 1 my ($self) = @_;
131 1 require Twilio::Rest::Studio::V1::Flow::Engagement::EngagementContext;
132 return Twilio::Rest::Studio::V1::Flow::Engagement::EngagementContextContext->new(
133 $self->{version},
134 $self->{solution}{flow_sid},
135 $self->{solution}{sid}
136 1 );
137 }
138  
139 3 ▶sub steps {
Subroutine steps: called CC=2 SCAR=6.9
140 3 my ($self, $sid) = @_;
141 3 require Twilio::Rest::Studio::V1::Flow::Engagement::Step;
142 my $list = Twilio::Rest::Studio::V1::Flow::Engagement::StepList->new(
143 $self->{version},
144 $self->{solution}{flow_sid},
145 $self->{solution}{sid}
146 3 );
147 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
148 }
149  
150 package Twilio::Rest::Studio::V1::Flow::EngagementInstance;
151  
152 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
153  
154 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
157 3 my ($class, $version, $payload, $flow_sid, $sid) = @_;
158 3 my $self = $class->SUPER::new($version, $payload);
159 3 ▶ $self->{solution} = { flow_sid => $flow_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
120
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
160 3 return $self;
161 }
162  
163 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
164 0 my ($self, @arguments) = @_;
165 0 return $self->_context->delete(@arguments);
166 }
167  
168 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
169 0 my ($self, @arguments) = @_;
170 0 return $self->_context->fetch(@arguments);
171 }
172  
173 0 ▶sub engagement_context {
Subroutine engagement_context: not called CC=1 SCAR=6.9
174 0 my ($self, @arguments) = @_;
175 0 return $self->_context->engagement_context(@arguments);
176 }
177  
178 0 ▶sub steps {
Subroutine steps: not called CC=1 SCAR=6.9
179 0 my ($self, @arguments) = @_;
180 0 return $self->_context->steps(@arguments);
181 }
182  
183 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
184 0 my ($self) = @_;
185 return Twilio::Rest::Studio::V1::Flow::EngagementContext->new(
186 $self->{version},
187 $self->{solution}{flow_sid},
188 $self->{solution}{sid}
189 0 );
190 }
191  
192 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
193 3 ▶sub contact_channel_address { return $_[0]{properties}{contact_channel_address} }
Subroutine contact_channel_address: called CC=1 SCAR=0.0
194 3 ▶sub contact_sid { return $_[0]{properties}{contact_sid} }
Subroutine contact_sid: called CC=1 SCAR=0.0
195 3 ▶sub context { return $_[0]{properties}{context} }
Subroutine context: called CC=1 SCAR=0.0
196 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
197 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
198 3 ▶sub flow_sid { return $_[0]{properties}{flow_sid} }
Subroutine flow_sid: called CC=1 SCAR=0.0
199 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
200 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
201 3 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
202 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
203  
204 2 1;
205  
206 __END__
« Twilio/Rest/Trusthub/V1/SupportingDocument.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Sip/Domain.pm »