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

filter: Statementstmt 82.4% 89 / 108 Branchbran 100% 2 / 2 Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 79.5% 35 / 44 Podpod n/a totaltotal 78.7% 130 / 165 CC 5 SCAR 3.0
CC
5
Cov
81%
create
2.0
page
2.0
new
2.0
CRAP 1.4
« Twilio/Rest/Webhooks/V1/SharedKey.pm ↑ Summary Twilio/Rest/Chat/V2/Service/User/UserChannel.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Studio::V1::Flow::Execution;
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::ExecutionList;
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 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 9 my ($class, $version, $flow_sid) = @_;
17 9 my $self = $class->SUPER::new($version);
18 9 $self->{solution} = { flow_sid => $flow_sid };
19 9 $self->{uri} = join q{}, '/Flows/', Twilio::Serialize::path_segment($flow_sid), '/Executions';
20 9 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::ExecutionInstance->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
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
52  
53 my $params = {
54 DateCreatedFrom => Twilio::Serialize::iso8601_date_time($options->{date_created_from}),
55 1 DateCreatedTo => Twilio::Serialize::iso8601_date_time($options->{date_created_to}),
56 PageToken => $page_token,
57 Page => $page_number,
58 PageSize => $page_size,
59 };
60  
61 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
62 1 return $self->_build_page($response);
63 }
64  
65 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
66 0 my ($self, $target_url) = @_;
67 0 my $client = $self->{version}->get_domain->get_client;
68 0 return $self->_build_page($client->request('GET', $target_url));
69 }
70  
71 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
72 1 my ($self, $response) = @_;
73 return Twilio::Rest::Studio::V1::Flow::ExecutionPage->new($self->{version}, $response,
74 1 $self->{solution});
75 }
76  
77 7 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
78 7 my ($self, $sid) = @_;
79 return Twilio::Rest::Studio::V1::Flow::ExecutionContext->new($self->{version},
80 7 $self->{solution}{flow_sid}, $sid);
81 }
82  
83 package Twilio::Rest::Studio::V1::Flow::ExecutionPage;
84  
85 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'executions' }
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 return Twilio::Rest::Studio::V1::Flow::ExecutionInstance->new($self->{version}, $payload,
92 1 $self->{solution}{flow_sid});
93 }
94  
95 package Twilio::Rest::Studio::V1::Flow::ExecutionContext;
96  
97 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 7 my ($class, $version, $flow_sid, $sid) = @_;
103 7 my $self = $class->SUPER::new($version);
104 7 $self->{solution} = { flow_sid => $flow_sid, sid => $sid };
105 7 $self->{uri} = join q{}, '/Flows/', Twilio::Serialize::path_segment($flow_sid), '/Executions/',
106 Twilio::Serialize::path_segment($sid);
107 7 return $self;
108 }
109  
110 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
111 1 my ($self) = @_;
112 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
113 1 return 1;
114 }
115  
116 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
117 1 my ($self) = @_;
118  
119 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
120 1 return $self->_build_instance($response);
121 }
122  
123 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
124 1 my ($self, $status) = @_;
125  
126 1 my $data = { Status => $status, };
127  
128 my $response =
129 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
130 1 return $self->_build_instance($response);
131 }
132  
133 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
134 2 my ($self, $response) = @_;
135 return Twilio::Rest::Studio::V1::Flow::ExecutionInstance->new(
136 $self->{version}, $response->get_content,
137 $self->{solution}{flow_sid}, $self->{solution}{sid}
138 2 );
139 }
140  
141 1 ▶sub execution_context {
Subroutine execution_context: called CC=1 SCAR=0.0
142 1 my ($self) = @_;
143 1 require Twilio::Rest::Studio::V1::Flow::Execution::ExecutionContext;
144 return Twilio::Rest::Studio::V1::Flow::Execution::ExecutionContextContext->new(
145 $self->{version},
146 $self->{solution}{flow_sid},
147 $self->{solution}{sid}
148 1 );
149 }
150  
151 3 ▶sub steps {
Subroutine steps: called CC=2 SCAR=6.9
152 3 my ($self, $sid) = @_;
153 3 require Twilio::Rest::Studio::V1::Flow::Execution::ExecutionStep;
154 my $list = Twilio::Rest::Studio::V1::Flow::Execution::ExecutionStepList->new(
155 $self->{version},
156 $self->{solution}{flow_sid},
157 $self->{solution}{sid}
158 3 );
159 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
160 }
161  
162 package Twilio::Rest::Studio::V1::Flow::ExecutionInstance;
163  
164 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
165  
166 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
167  
168 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
169 4 my ($class, $version, $payload, $flow_sid, $sid) = @_;
170 4 my $self = $class->SUPER::new($version, $payload);
171 4 ▶ $self->{solution} = { flow_sid => $flow_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
172 4 return $self;
173 }
174  
175 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
176 0 my ($self, @arguments) = @_;
177 0 return $self->_context->delete(@arguments);
178 }
179  
180 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
181 0 my ($self, @arguments) = @_;
182 0 return $self->_context->fetch(@arguments);
183 }
184  
185 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
186 0 my ($self, @arguments) = @_;
187 0 return $self->_context->update(@arguments);
188 }
189  
190 0 ▶sub execution_context {
Subroutine execution_context: not called CC=1 SCAR=6.9
191 0 my ($self, @arguments) = @_;
192 0 return $self->_context->execution_context(@arguments);
193 }
194  
195 0 ▶sub steps {
Subroutine steps: not called CC=1 SCAR=6.9
196 0 my ($self, @arguments) = @_;
197 0 return $self->_context->steps(@arguments);
198 }
199  
200 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
201 0 my ($self) = @_;
202 return Twilio::Rest::Studio::V1::Flow::ExecutionContext->new(
203 $self->{version},
204 $self->{solution}{flow_sid},
205 $self->{solution}{sid}
206 0 );
207 }
208  
209 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
210 4 ▶sub contact_channel_address { return $_[0]{properties}{contact_channel_address} }
Subroutine contact_channel_address: called CC=1 SCAR=0.0
211 4 ▶sub contact_sid { return $_[0]{properties}{contact_sid} }
Subroutine contact_sid: called CC=1 SCAR=0.0
212 4 ▶sub context { return $_[0]{properties}{context} }
Subroutine context: called CC=1 SCAR=0.0
213 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
214 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
215 4 ▶sub flow_sid { return $_[0]{properties}{flow_sid} }
Subroutine flow_sid: called CC=1 SCAR=0.0
216 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
217 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
218 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
219 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
220  
221 2 1;
222  
223 __END__
« Twilio/Rest/Webhooks/V1/SharedKey.pm ↑ Summary Twilio/Rest/Chat/V2/Service/User/UserChannel.pm »