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

filter: Statementstmt 84.3% 81 / 96 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 81.5% 31 / 38 Podpod n/a totaltotal 79.0% 117 / 148 CC 5 SCAR 3.1
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/IpMessaging/V2/Service/Channel/Webhook.pm ↑ Summary Twilio/Rest/Conversations/V1/Service/Conversation/Participant.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Taskrouter::V1::Workspace::Activity;
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::ActivityList;
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 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 5 my ($class, $version, $workspace_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { workspace_sid => $workspace_sid };
19 5 $self->{uri} = join q{}, '/Workspaces/', Twilio::Serialize::path_segment($workspace_sid),
20 '/Activities';
21 5 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 1 Available => Twilio::Serialize::boolean_to_string($options->{available}),
31 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Taskrouter::V1::Workspace::ActivityInstance->new($self->{version},
36 1 $response->get_content, $self->{solution}{workspace_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 Available => $options->{available},
55 FriendlyName => $options->{friendly_name},
56 1 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::Taskrouter::V1::Workspace::ActivityPage->new($self->{version}, $response,
74 1 $self->{solution});
75 }
76  
77 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
78 3 my ($self, $sid) = @_;
79 return Twilio::Rest::Taskrouter::V1::Workspace::ActivityContext->new($self->{version},
80 3 $self->{solution}{workspace_sid}, $sid);
81 }
82  
83 package Twilio::Rest::Taskrouter::V1::Workspace::ActivityPage;
84  
85 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'activities' }
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::Taskrouter::V1::Workspace::ActivityInstance->new($self->{version}, $payload,
92 1 $self->{solution}{workspace_sid});
93 }
94  
95 package Twilio::Rest::Taskrouter::V1::Workspace::ActivityContext;
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 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 3 my ($class, $version, $workspace_sid, $sid) = @_;
103 3 my $self = $class->SUPER::new($version);
104 3 $self->{solution} = { workspace_sid => $workspace_sid, sid => $sid };
105 3 $self->{uri} = join q{}, '/Workspaces/', Twilio::Serialize::path_segment($workspace_sid),
106 '/Activities/', Twilio::Serialize::path_segment($sid);
107 3 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=2 SCAR=7.0
124 1 my ($self, $options) = @_;
125 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
126  
127 1 my $data = { FriendlyName => $options->{friendly_name}, };
128  
129 my $response =
130 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
131 1 return $self->_build_instance($response);
132 }
133  
134 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
135 2 my ($self, $response) = @_;
136 return Twilio::Rest::Taskrouter::V1::Workspace::ActivityInstance->new(
137 $self->{version}, $response->get_content,
138 $self->{solution}{workspace_sid}, $self->{solution}{sid}
139 2 );
140 }
141  
142 package Twilio::Rest::Taskrouter::V1::Workspace::ActivityInstance;
143  
144 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
149 4 my ($class, $version, $payload, $workspace_sid, $sid) = @_;
150 4 my $self = $class->SUPER::new($version, $payload);
151 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
152 4 return $self;
153 }
154  
155 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
156 0 my ($self, @arguments) = @_;
157 0 return $self->_context->delete(@arguments);
158 }
159  
160 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
161 0 my ($self, @arguments) = @_;
162 0 return $self->_context->fetch(@arguments);
163 }
164  
165 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->update(@arguments);
168 }
169  
170 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
171 0 my ($self) = @_;
172 return Twilio::Rest::Taskrouter::V1::Workspace::ActivityContext->new(
173 $self->{version},
174 $self->{solution}{workspace_sid},
175 $self->{solution}{sid}
176 0 );
177 }
178  
179 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
180 4 ▶sub available { return $_[0]{properties}{available} }
Subroutine available: called CC=1 SCAR=0.0
181 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
182 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
183 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
184 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
185 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
186 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
187 4 ▶sub workspace_sid { return $_[0]{properties}{workspace_sid} }
Subroutine workspace_sid: called CC=1 SCAR=0.0
188  
189 2 1;
190  
191 __END__
« Twilio/Rest/IpMessaging/V2/Service/Channel/Webhook.pm ↑ Summary Twilio/Rest/Conversations/V1/Service/Conversation/Participant.pm »