Twilio/Rest/Studio/V2/Flow.pm

filter: Statementstmt 82.5% 99 / 120 Branchbran 100% 4 / 4 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.3% 41 / 51 Podpod n/a totaltotal 78.8% 149 / 189 CC 7 SCAR 3.3
CC
7
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Preview/Marketplace/InstalledAddOn.pm ↑ Summary Twilio/Rest/Conversations/V1/Conversation/Message.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Studio::V2::Flow;
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::V2::FlowList;
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 18 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 18 my ($class, $version) = @_;
17 18 my $self = $class->SUPER::new($version);
18 18 $self->{solution} = {};
19 18 $self->{uri} = '/Flows';
20 18 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $friendly_name, $status, $definition, $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 FriendlyName => $friendly_name,
29 Status => $status,
30 Definition => Twilio::Serialize::json_object($definition),
31 AuthorSid => $options->{author_sid},
32 CommitMessage => $options->{commit_message},
33 1 };
34  
35 my $response =
36 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
37 1 return Twilio::Rest::Studio::V2::FlowInstance->new($self->{version}, $response->get_content);
38 }
39  
40 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
41 0 my ($self, @arguments) = @_;
42 0 return $self->read_records(@arguments);
43 }
44  
45 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->stream_records(@arguments);
48 }
49  
50 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
51 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
52 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
53  
54 1 my $params = {
55 PageToken => $page_token,
56 Page => $page_number,
57 PageSize => $page_size,
58 };
59  
60 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
61 1 return $self->_build_page($response);
62 }
63  
64 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
65 0 my ($self, $target_url) = @_;
66 0 my $client = $self->{version}->get_domain->get_client;
67 0 return $self->_build_page($client->request('GET', $target_url));
68 }
69  
70 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
71 1 my ($self, $response) = @_;
72 1 return Twilio::Rest::Studio::V2::FlowPage->new($self->{version}, $response, $self->{solution});
73 }
74  
75 16 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
76 16 my ($self, $sid) = @_;
77 16 return Twilio::Rest::Studio::V2::FlowContext->new($self->{version}, $sid);
78 }
79  
80 package Twilio::Rest::Studio::V2::FlowPage;
81  
82 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
83  
84 1 ▶sub records_key { return 'flows' }
Subroutine records_key: called CC=1 SCAR=0.0
85  
86 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
87 1 my ($self, $payload) = @_;
88 1 return Twilio::Rest::Studio::V2::FlowInstance->new($self->{version}, $payload);
89 }
90  
91 package Twilio::Rest::Studio::V2::FlowContext;
92  
93 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 16 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
98 16 my ($class, $version, $sid) = @_;
99 16 my $self = $class->SUPER::new($version);
100 16 $self->{solution} = { sid => $sid };
101 16 $self->{uri} = join q{}, '/Flows/', Twilio::Serialize::path_segment($sid);
102 16 return $self;
103 }
104  
105 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
106 1 my ($self) = @_;
107 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
108 1 return 1;
109 }
110  
111 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
112 1 my ($self) = @_;
113  
114 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
115 1 return $self->_build_instance($response);
116 }
117  
118 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
119 1 my ($self, $status, $options) = @_;
120 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
121  
122 my $data = {
123 Status => $status,
124 AuthorSid => $options->{author_sid},
125 CommitMessage => $options->{commit_message},
126 Definition => Twilio::Serialize::json_object($options->{definition}),
127 FriendlyName => $options->{friendly_name},
128 1 };
129  
130 my $response =
131 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
132 1 return $self->_build_instance($response);
133 }
134  
135 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
136 2 my ($self, $response) = @_;
137 return Twilio::Rest::Studio::V2::FlowInstance->new($self->{version}, $response->get_content,
138 2 $self->{solution}{sid});
139 }
140  
141 9 ▶sub executions {
Subroutine executions: called CC=2 SCAR=6.9
142 9 my ($self, $sid) = @_;
143 9 require Twilio::Rest::Studio::V2::Flow::Execution;
144 my $list =
145 9 Twilio::Rest::Studio::V2::Flow::ExecutionList->new($self->{version}, $self->{solution}{sid});
146 9 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 7 2 9
147 }
148  
149 2 ▶sub revisions {
Subroutine revisions: called CC=2 SCAR=6.9
150 2 my ($self, $revision) = @_;
151 2 require Twilio::Rest::Studio::V2::Flow::FlowRevision;
152 my $list =
153 2 Twilio::Rest::Studio::V2::Flow::FlowRevisionList->new($self->{version}, $self->{solution}{sid});
154 2 ▶ return defined $revision ? $list->get_context($revision) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $revision ? : 1 1 2
155 }
156  
157 2 ▶sub test_users {
Subroutine test_users: called CC=1 SCAR=0.0
158 2 my ($self) = @_;
159 2 require Twilio::Rest::Studio::V2::Flow::FlowTestUser;
160 return Twilio::Rest::Studio::V2::Flow::FlowTestUserContext->new($self->{version},
161 2 $self->{solution}{sid});
162 }
163  
164 package Twilio::Rest::Studio::V2::FlowInstance;
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 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
171 4 my ($class, $version, $payload, $sid) = @_;
172 4 my $self = $class->SUPER::new($version, $payload);
173 4 ▶ $self->{solution} = { 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
174 4 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 update {
Subroutine update: not called CC=1 SCAR=6.9
188 0 my ($self, @arguments) = @_;
189 0 return $self->_context->update(@arguments);
190 }
191  
192 0 ▶sub executions {
Subroutine executions: not called CC=1 SCAR=6.9
193 0 my ($self, @arguments) = @_;
194 0 return $self->_context->executions(@arguments);
195 }
196  
197 0 ▶sub revisions {
Subroutine revisions: not called CC=1 SCAR=6.9
198 0 my ($self, @arguments) = @_;
199 0 return $self->_context->revisions(@arguments);
200 }
201  
202 0 ▶sub test_users {
Subroutine test_users: not called CC=1 SCAR=6.9
203 0 my ($self, @arguments) = @_;
204 0 return $self->_context->test_users(@arguments);
205 }
206  
207 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
208 0 my ($self) = @_;
209 0 return Twilio::Rest::Studio::V2::FlowContext->new($self->{version}, $self->{solution}{sid});
210 }
211  
212 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
213 4 ▶sub author_sid { return $_[0]{properties}{author_sid} }
Subroutine author_sid: called CC=1 SCAR=0.0
214 4 ▶sub commit_message { return $_[0]{properties}{commit_message} }
Subroutine commit_message: called CC=1 SCAR=0.0
215 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
216 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
217 4 ▶sub definition { return $_[0]{properties}{definition} }
Subroutine definition: called CC=1 SCAR=0.0
218 4 ▶sub errors { return $_[0]{properties}{errors} }
Subroutine errors: called CC=1 SCAR=0.0
219 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
220 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
221 4 ▶sub revision { return $_[0]{properties}{revision} }
Subroutine revision: called CC=1 SCAR=0.0
222 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
223 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
224 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
225 4 ▶sub valid { return $_[0]{properties}{valid} }
Subroutine valid: called CC=1 SCAR=0.0
226 4 ▶sub warnings { return $_[0]{properties}{warnings} }
Subroutine warnings: called CC=1 SCAR=0.0
227 4 ▶sub webhook_url { return $_[0]{properties}{webhook_url} }
Subroutine webhook_url: called CC=1 SCAR=0.0
228  
229 2 1;
230  
231 __END__
« Twilio/Rest/Preview/Marketplace/InstalledAddOn.pm ↑ Summary Twilio/Rest/Conversations/V1/Conversation/Message.pm »