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

filter: Statementstmt 80.9% 106 / 131 Branchbran 100% 4 / 4 Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 77.3% 41 / 53 Podpod n/a totaltotal 76.5% 157 / 205 CC 8 SCAR 3.6
CC
8
Cov
79%
delete
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls.pm ↑ Summary Twilio/Rest/Trunking/V1/Trunk.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Taskrouter::V1::Workspace::Worker;
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::WorkerList;
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 15 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 15 my ($class, $version, $workspace_sid) = @_;
17 15 my $self = $class->SUPER::new($version);
18 15 $self->{solution} = { workspace_sid => $workspace_sid };
19 15 $self->{uri} = join q{}, '/Workspaces/', Twilio::Serialize::path_segment($workspace_sid),
20 '/Workers';
21 15 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $friendly_name, $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 FriendlyName => $friendly_name,
30 ActivitySid => $options->{activity_sid},
31 Attributes => $options->{attributes},
32 1 };
33  
34 my $response =
35 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
36 return Twilio::Rest::Taskrouter::V1::Workspace::WorkerInstance->new($self->{version},
37 1 $response->get_content, $self->{solution}{workspace_sid});
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
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
53  
54 my $params = {
55 ActivityName => $options->{activity_name},
56 ActivitySid => $options->{activity_sid},
57 Available => $options->{available},
58 FriendlyName => $options->{friendly_name},
59 Ordering => $options->{ordering},
60 TargetWorkersExpression => $options->{target_workers_expression},
61 TaskQueueName => $options->{task_queue_name},
62 TaskQueueSid => $options->{task_queue_sid},
63 1 PageToken => $page_token,
64 Page => $page_number,
65 PageSize => $page_size,
66 };
67  
68 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
69 1 return $self->_build_page($response);
70 }
71  
72 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
73 0 my ($self, $target_url) = @_;
74 0 my $client = $self->{version}->get_domain->get_client;
75 0 return $self->_build_page($client->request('GET', $target_url));
76 }
77  
78 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
79 1 my ($self, $response) = @_;
80 return Twilio::Rest::Taskrouter::V1::Workspace::WorkerPage->new($self->{version}, $response,
81 1 $self->{solution});
82 }
83  
84 12 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
85 12 my ($self, $sid) = @_;
86 return Twilio::Rest::Taskrouter::V1::Workspace::WorkerContext->new($self->{version},
87 12 $self->{solution}{workspace_sid}, $sid);
88 }
89  
90 1 ▶sub statistics {
Subroutine statistics: called CC=1 SCAR=0.0
91 1 my ($self) = @_;
92 1 require Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersStatistics;
93 return Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersStatisticsContext->new(
94 1 $self->{version}, $self->{solution}{workspace_sid});
95 }
96  
97 package Twilio::Rest::Taskrouter::V1::Workspace::WorkerPage;
98  
99 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 1 ▶sub records_key { return 'workers' }
Subroutine records_key: called CC=1 SCAR=0.0
102  
103 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
104 1 my ($self, $payload) = @_;
105 return Twilio::Rest::Taskrouter::V1::Workspace::WorkerInstance->new($self->{version}, $payload,
106 1 $self->{solution}{workspace_sid});
107 }
108  
109 package Twilio::Rest::Taskrouter::V1::Workspace::WorkerContext;
110  
111 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
112  
113 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
114  
115 12 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
116 12 my ($class, $version, $workspace_sid, $sid) = @_;
117 12 my $self = $class->SUPER::new($version);
118 12 $self->{solution} = { workspace_sid => $workspace_sid, sid => $sid };
119 12 $self->{uri} = join q{}, '/Workspaces/', Twilio::Serialize::path_segment($workspace_sid),
120 '/Workers/', Twilio::Serialize::path_segment($sid);
121 12 return $self;
122 }
123  
124 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
125 1 my ($self, $options) = @_;
126 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
127 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
128 1 { headers => { 'If-Match' => $options->{if_match}, } });
129 1 return 1;
130 }
131  
132 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
133 1 my ($self) = @_;
134  
135 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
136 1 return $self->_build_instance($response);
137 }
138  
139 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
140 1 my ($self, $options) = @_;
141 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
142  
143 my $data = {
144 ActivitySid => $options->{activity_sid},
145 Attributes => $options->{attributes},
146 FriendlyName => $options->{friendly_name},
147 RejectPendingReservations =>
148 1 Twilio::Serialize::boolean_to_string($options->{reject_pending_reservations}),
149 };
150  
151 my $response = $self->{version}->handle_request(
152 'POST',
153 $self->{uri},
154 'update',
155 {
156 data => $data,
157 headers => { 'If-Match' => $options->{if_match}, }
158 }
159 1 );
160 1 return $self->_build_instance($response);
161 }
162  
163 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
164 2 my ($self, $response) = @_;
165 return Twilio::Rest::Taskrouter::V1::Workspace::WorkerInstance->new(
166 $self->{version}, $response->get_content,
167 $self->{solution}{workspace_sid}, $self->{solution}{sid}
168 2 );
169 }
170  
171 3 ▶sub reservations {
Subroutine reservations: called CC=2 SCAR=6.9
172 3 my ($self, $sid) = @_;
173 3 require Twilio::Rest::Taskrouter::V1::Workspace::Worker::Reservation;
174 my $list = Twilio::Rest::Taskrouter::V1::Workspace::Worker::ReservationList->new(
175 $self->{version},
176 $self->{solution}{workspace_sid},
177 $self->{solution}{sid}
178 3 );
179 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
180 }
181  
182 3 ▶sub worker_channels {
Subroutine worker_channels: called CC=2 SCAR=6.9
183 3 my ($self, $sid) = @_;
184 3 require Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkerChannel;
185 my $list = Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkerChannelList->new(
186 $self->{version},
187 $self->{solution}{workspace_sid},
188 $self->{solution}{sid}
189 3 );
190 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
191 }
192  
193 1 ▶sub statistics {
Subroutine statistics: called CC=1 SCAR=0.0
194 1 my ($self) = @_;
195 1 require Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkerStatistics;
196 return Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkerStatisticsContext->new(
197 $self->{version},
198 $self->{solution}{workspace_sid},
199 $self->{solution}{sid}
200 1 );
201 }
202  
203 1 ▶sub cumulative_statistics {
Subroutine cumulative_statistics: called CC=1 SCAR=0.0
204 1 my ($self) = @_;
205 1 require Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersCumulativeStatistics;
206 return Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersCumulativeStatisticsContext->new(
207 1 $self->{version}, $self->{solution}{workspace_sid});
208 }
209  
210 1 ▶sub real_time_statistics {
Subroutine real_time_statistics: called CC=1 SCAR=0.0
211 1 my ($self) = @_;
212 1 require Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersRealTimeStatistics;
213 return Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersRealTimeStatisticsContext->new(
214 1 $self->{version}, $self->{solution}{workspace_sid});
215 }
216  
217 package Twilio::Rest::Taskrouter::V1::Workspace::WorkerInstance;
218  
219 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
220  
221 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
222  
223 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
224 4 my ($class, $version, $payload, $workspace_sid, $sid) = @_;
225 4 my $self = $class->SUPER::new($version, $payload);
226 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
227 4 return $self;
228 }
229  
230 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
231 0 my ($self, @arguments) = @_;
232 0 return $self->_context->delete(@arguments);
233 }
234  
235 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
236 0 my ($self, @arguments) = @_;
237 0 return $self->_context->fetch(@arguments);
238 }
239  
240 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
241 0 my ($self, @arguments) = @_;
242 0 return $self->_context->update(@arguments);
243 }
244  
245 0 ▶sub reservations {
Subroutine reservations: not called CC=1 SCAR=6.9
246 0 my ($self, @arguments) = @_;
247 0 return $self->_context->reservations(@arguments);
248 }
249  
250 0 ▶sub worker_channels {
Subroutine worker_channels: not called CC=1 SCAR=6.9
251 0 my ($self, @arguments) = @_;
252 0 return $self->_context->worker_channels(@arguments);
253 }
254  
255 0 ▶sub statistics {
Subroutine statistics: not called CC=1 SCAR=6.9
256 0 my ($self, @arguments) = @_;
257 0 return $self->_context->statistics(@arguments);
258 }
259  
260 0 ▶sub cumulative_statistics {
Subroutine cumulative_statistics: not called CC=1 SCAR=6.9
261 0 my ($self, @arguments) = @_;
262 0 return $self->_context->cumulative_statistics(@arguments);
263 }
264  
265 0 ▶sub real_time_statistics {
Subroutine real_time_statistics: not called CC=1 SCAR=6.9
266 0 my ($self, @arguments) = @_;
267 0 return $self->_context->real_time_statistics(@arguments);
268 }
269  
270 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
271 0 my ($self) = @_;
272 return Twilio::Rest::Taskrouter::V1::Workspace::WorkerContext->new(
273 $self->{version},
274 $self->{solution}{workspace_sid},
275 $self->{solution}{sid}
276 0 );
277 }
278  
279 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
280 4 ▶sub activity_name { return $_[0]{properties}{activity_name} }
Subroutine activity_name: called CC=1 SCAR=0.0
281 4 ▶sub activity_sid { return $_[0]{properties}{activity_sid} }
Subroutine activity_sid: called CC=1 SCAR=0.0
282 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
283 4 ▶sub available { return $_[0]{properties}{available} }
Subroutine available: called CC=1 SCAR=0.0
284 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
285  
286 4 ▶sub date_status_changed {
Subroutine date_status_changed: called CC=1 SCAR=0.0
287 4 return Twilio::Deserialize::date_time($_[0]{properties}{date_status_changed});
288 }
289 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
290 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
291 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
292 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
293 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
294 4 ▶sub workspace_sid { return $_[0]{properties}{workspace_sid} }
Subroutine workspace_sid: called CC=1 SCAR=0.0
295  
296 2 1;
297  
298 __END__
« Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls.pm ↑ Summary Twilio/Rest/Trunking/V1/Trunk.pm »