Twilio/Rest/Taskrouter/V1/Workspace/Task.pm

filter: Statementstmt 85.5% 101 / 118 Branchbran 100% 2 / 2 Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 85.4% 47 / 55 Podpod n/a totaltotal 81.2% 156 / 192 CC 7 SCAR 2.9
CC
7
Cov
83%
delete
2.0
create
2.0
page
2.0
CRAP 1.3
« Twilio/Rest/Preview/Marketplace/AvailableAddOn.pm ↑ Summary Twilio/Rest/Video/V1/Room.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Taskrouter::V1::Workspace::Task;
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::Taskrouter::V1::Workspace::TaskList;
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, $workspace_sid) = @_;
17 8 my $self = $class->SUPER::new($version);
18 8 $self->{solution} = { workspace_sid => $workspace_sid };
19 8 $self->{uri} = join q{}, '/Workspaces/', Twilio::Serialize::path_segment($workspace_sid),
20 '/Tasks';
21 8 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $options) = @_;
26 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
27  
28 my $data = {
29 Attributes => $options->{attributes},
30 IgnoreCapacity => $options->{ignore_capacity},
31 Priority => $options->{priority},
32 RoutingTarget => $options->{routing_target},
33 TaskChannel => $options->{task_channel},
34 TaskQueueSid => $options->{task_queue_sid},
35 Timeout => $options->{timeout},
36 VirtualStartTime => Twilio::Serialize::iso8601_date_time($options->{virtual_start_time}),
37 WorkflowSid => $options->{workflow_sid},
38 1 };
39  
40 my $response =
41 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
42 return Twilio::Rest::Taskrouter::V1::Workspace::TaskInstance->new($self->{version},
43 1 $response->get_content, $self->{solution}{workspace_sid});
44 }
45  
46 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
47 0 my ($self, @arguments) = @_;
48 0 return $self->read_records(@arguments);
49 }
50  
51 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
52 0 my ($self, @arguments) = @_;
53 0 return $self->stream_records(@arguments);
54 }
55  
56 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
57 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
58 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
59  
60 my $params = {
61 AssignmentStatus => $options->{assignment_status},
62 EvaluateTaskAttributes => $options->{evaluate_task_attributes},
63 HasAddons => Twilio::Serialize::boolean_to_string($options->{has_addons}),
64 Ordering => $options->{ordering},
65 Priority => $options->{priority},
66 RoutingTarget => $options->{routing_target},
67 TaskQueueName => $options->{task_queue_name},
68 TaskQueueSid => $options->{task_queue_sid},
69 WorkflowName => $options->{workflow_name},
70 WorkflowSid => $options->{workflow_sid},
71 1 PageToken => $page_token,
72 Page => $page_number,
73 PageSize => $page_size,
74 };
75  
76 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
77 1 return $self->_build_page($response);
78 }
79  
80 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
81 0 my ($self, $target_url) = @_;
82 0 my $client = $self->{version}->get_domain->get_client;
83 0 return $self->_build_page($client->request('GET', $target_url));
84 }
85  
86 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
87 1 my ($self, $response) = @_;
88 return Twilio::Rest::Taskrouter::V1::Workspace::TaskPage->new($self->{version}, $response,
89 1 $self->{solution});
90 }
91  
92 6 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
93 6 my ($self, $sid) = @_;
94 return Twilio::Rest::Taskrouter::V1::Workspace::TaskContext->new($self->{version},
95 6 $self->{solution}{workspace_sid}, $sid);
96 }
97  
98 package Twilio::Rest::Taskrouter::V1::Workspace::TaskPage;
99  
100 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 1 ▶sub records_key { return 'tasks' }
Subroutine records_key: called CC=1 SCAR=0.0
103  
104 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
105 1 my ($self, $payload) = @_;
106 return Twilio::Rest::Taskrouter::V1::Workspace::TaskInstance->new($self->{version}, $payload,
107 1 $self->{solution}{workspace_sid});
108 }
109  
110 package Twilio::Rest::Taskrouter::V1::Workspace::TaskContext;
111  
112 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
113  
114 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
115  
116 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
117 6 my ($class, $version, $workspace_sid, $sid) = @_;
118 6 my $self = $class->SUPER::new($version);
119 6 $self->{solution} = { workspace_sid => $workspace_sid, sid => $sid };
120 6 $self->{uri} = join q{}, '/Workspaces/', Twilio::Serialize::path_segment($workspace_sid),
121 '/Tasks/', Twilio::Serialize::path_segment($sid);
122 6 return $self;
123 }
124  
125 1 ▶sub delete {
Subroutine delete: 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 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
129 1 { headers => { 'If-Match' => $options->{if_match}, } });
130 1 return 1;
131 }
132  
133 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
134 1 my ($self) = @_;
135  
136 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
137 1 return $self->_build_instance($response);
138 }
139  
140 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
141 1 my ($self, $options) = @_;
142 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
143  
144 my $data = {
145 AssignmentStatus => $options->{assignment_status},
146 Attributes => $options->{attributes},
147 Priority => $options->{priority},
148 Reason => $options->{reason},
149 TaskChannel => $options->{task_channel},
150 1 VirtualStartTime => Twilio::Serialize::iso8601_date_time($options->{virtual_start_time}),
151 };
152  
153 my $response = $self->{version}->handle_request(
154 'POST',
155 $self->{uri},
156 'update',
157 {
158 data => $data,
159 headers => { 'If-Match' => $options->{if_match}, }
160 }
161 1 );
162 1 return $self->_build_instance($response);
163 }
164  
165 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
166 2 my ($self, $response) = @_;
167 return Twilio::Rest::Taskrouter::V1::Workspace::TaskInstance->new(
168 $self->{version}, $response->get_content,
169 $self->{solution}{workspace_sid}, $self->{solution}{sid}
170 2 );
171 }
172  
173 3 ▶sub reservations {
Subroutine reservations: called CC=2 SCAR=6.9
174 3 my ($self, $sid) = @_;
175 3 require Twilio::Rest::Taskrouter::V1::Workspace::Task::Reservation;
176 my $list = Twilio::Rest::Taskrouter::V1::Workspace::Task::ReservationList->new(
177 $self->{version},
178 $self->{solution}{workspace_sid},
179 $self->{solution}{sid}
180 3 );
181 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
182 }
183  
184 package Twilio::Rest::Taskrouter::V1::Workspace::TaskInstance;
185  
186 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
187  
188 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
189  
190 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
191 4 my ($class, $version, $payload, $workspace_sid, $sid) = @_;
192 4 my $self = $class->SUPER::new($version, $payload);
193 4 ▶ $self->{solution} = { workspace_sid => $workspace_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
194 4 return $self;
195 }
196  
197 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
198 0 my ($self, @arguments) = @_;
199 0 return $self->_context->delete(@arguments);
200 }
201  
202 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
203 0 my ($self, @arguments) = @_;
204 0 return $self->_context->fetch(@arguments);
205 }
206  
207 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
208 0 my ($self, @arguments) = @_;
209 0 return $self->_context->update(@arguments);
210 }
211  
212 0 ▶sub reservations {
Subroutine reservations: not called CC=1 SCAR=6.9
213 0 my ($self, @arguments) = @_;
214 0 return $self->_context->reservations(@arguments);
215 }
216  
217 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
218 0 my ($self) = @_;
219 return Twilio::Rest::Taskrouter::V1::Workspace::TaskContext->new(
220 $self->{version},
221 $self->{solution}{workspace_sid},
222 $self->{solution}{sid}
223 0 );
224 }
225  
226 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
227 4 ▶sub addons { return $_[0]{properties}{addons} }
Subroutine addons: called CC=1 SCAR=0.0
228 4 ▶sub age { return $_[0]{properties}{age} }
Subroutine age: called CC=1 SCAR=0.0
229 4 ▶sub assignment_status { return $_[0]{properties}{assignment_status} }
Subroutine assignment_status: called CC=1 SCAR=0.0
230 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
231 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
232 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
233 4 ▶sub ignore_capacity { return $_[0]{properties}{ignore_capacity} }
Subroutine ignore_capacity: called CC=1 SCAR=0.0
234 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
235 4 ▶sub priority { return $_[0]{properties}{priority} }
Subroutine priority: called CC=1 SCAR=0.0
236 4 ▶sub reason { return $_[0]{properties}{reason} }
Subroutine reason: called CC=1 SCAR=0.0
237 4 ▶sub routing_target { return $_[0]{properties}{routing_target} }
Subroutine routing_target: called CC=1 SCAR=0.0
238 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
239 4 ▶sub task_channel_sid { return $_[0]{properties}{task_channel_sid} }
Subroutine task_channel_sid: called CC=1 SCAR=0.0
240 4 ▶sub task_channel_unique_name { return $_[0]{properties}{task_channel_unique_name} }
Subroutine task_channel_unique_name: called CC=1 SCAR=0.0
241  
242 4 ▶sub task_queue_entered_date {
Subroutine task_queue_entered_date: called CC=1 SCAR=0.0
243 4 return Twilio::Deserialize::date_time($_[0]{properties}{task_queue_entered_date});
244 }
245 4 ▶sub task_queue_friendly_name { return $_[0]{properties}{task_queue_friendly_name} }
Subroutine task_queue_friendly_name: called CC=1 SCAR=0.0
246 4 ▶sub task_queue_sid { return $_[0]{properties}{task_queue_sid} }
Subroutine task_queue_sid: called CC=1 SCAR=0.0
247 4 ▶sub timeout { return $_[0]{properties}{timeout} }
Subroutine timeout: called CC=1 SCAR=0.0
248 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
249  
250 4 ▶sub virtual_start_time {
Subroutine virtual_start_time: called CC=1 SCAR=0.0
251 4 return Twilio::Deserialize::date_time($_[0]{properties}{virtual_start_time});
252 }
253 4 ▶sub workflow_friendly_name { return $_[0]{properties}{workflow_friendly_name} }
Subroutine workflow_friendly_name: called CC=1 SCAR=0.0
254 4 ▶sub workflow_sid { return $_[0]{properties}{workflow_sid} }
Subroutine workflow_sid: called CC=1 SCAR=0.0
255 4 ▶sub workspace_sid { return $_[0]{properties}{workspace_sid} }
Subroutine workspace_sid: called CC=1 SCAR=0.0
256  
257 2 1;
258  
259 __END__
« Twilio/Rest/Preview/Marketplace/AvailableAddOn.pm ↑ Summary Twilio/Rest/Video/V1/Room.pm »