Twilio/Rest/Intelligence/V2/CustomOperator.pm

filter: Statementstmt 84.6% 83 / 98 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 82.9% 34 / 41 Podpod n/a totaltotal 80.6% 121 / 150 CC 4 SCAR 2.6
CC
4
Cov
83%
page
2.0
update
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeRegistrations/AuthRegistrationsCredentialListMapping.pm ↑ Summary Twilio/Rest/Taskrouter/V1/Workspace/Task/Reservation.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Intelligence::V2::CustomOperator;
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::Intelligence::V2::CustomOperatorList;
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) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = {};
19 5 $self->{uri} = '/Operators/Custom';
20 5 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 1 my ($self, $friendly_name, $operator_type, $config) = @_;
25  
26 1 my $data = {
27 FriendlyName => $friendly_name,
28 OperatorType => $operator_type,
29 Config => Twilio::Serialize::json_object($config),
30 };
31  
32 my $response =
33 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
34 return Twilio::Rest::Intelligence::V2::CustomOperatorInstance->new($self->{version},
35 1 $response->get_content);
36 }
37  
38 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
39 0 my ($self, @arguments) = @_;
40 0 return $self->read_records(@arguments);
41 }
42  
43 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
44 0 my ($self, @arguments) = @_;
45 0 return $self->stream_records(@arguments);
46 }
47  
48 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
49 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
50 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
51  
52 my $params = {
53 Availability => $options->{availability},
54 LanguageCode => $options->{language_code},
55 1 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 return Twilio::Rest::Intelligence::V2::CustomOperatorPage->new($self->{version}, $response,
73 1 $self->{solution});
74 }
75  
76 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
77 3 my ($self, $sid) = @_;
78 3 return Twilio::Rest::Intelligence::V2::CustomOperatorContext->new($self->{version}, $sid);
79 }
80  
81 package Twilio::Rest::Intelligence::V2::CustomOperatorPage;
82  
83 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 1 ▶sub records_key { return 'operators' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 1 my ($self, $payload) = @_;
89 1 return Twilio::Rest::Intelligence::V2::CustomOperatorInstance->new($self->{version}, $payload);
90 }
91  
92 package Twilio::Rest::Intelligence::V2::CustomOperatorContext;
93  
94 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
99 3 my ($class, $version, $sid) = @_;
100 3 my $self = $class->SUPER::new($version);
101 3 $self->{solution} = { sid => $sid };
102 3 $self->{uri} = join q{}, '/Operators/Custom/', Twilio::Serialize::path_segment($sid);
103 3 return $self;
104 }
105  
106 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
107 1 my ($self) = @_;
108 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
109 1 return 1;
110 }
111  
112 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
113 1 my ($self) = @_;
114  
115 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
116 1 return $self->_build_instance($response);
117 }
118  
119 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
120 1 my ($self, $friendly_name, $config, $options) = @_;
121 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
122  
123 1 my $data = {
124 FriendlyName => $friendly_name,
125 Config => Twilio::Serialize::json_object($config),
126 };
127  
128 my $response = $self->{version}->handle_request(
129 'POST',
130 $self->{uri},
131 'update',
132 {
133 data => $data,
134 headers => { 'If-Match' => $options->{if_match}, }
135 }
136 1 );
137 1 return $self->_build_instance($response);
138 }
139  
140 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
141 2 my ($self, $response) = @_;
142 return Twilio::Rest::Intelligence::V2::CustomOperatorInstance->new($self->{version},
143 2 $response->get_content, $self->{solution}{sid});
144 }
145  
146 package Twilio::Rest::Intelligence::V2::CustomOperatorInstance;
147  
148 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
149  
150 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
151  
152 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
153 4 my ($class, $version, $payload, $sid) = @_;
154 4 my $self = $class->SUPER::new($version, $payload);
155 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
156 4 return $self;
157 }
158  
159 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
160 0 my ($self, @arguments) = @_;
161 0 return $self->_context->delete(@arguments);
162 }
163  
164 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
165 0 my ($self, @arguments) = @_;
166 0 return $self->_context->fetch(@arguments);
167 }
168  
169 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
170 0 my ($self, @arguments) = @_;
171 0 return $self->_context->update(@arguments);
172 }
173  
174 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
175 0 my ($self) = @_;
176 return Twilio::Rest::Intelligence::V2::CustomOperatorContext->new($self->{version},
177 0 $self->{solution}{sid});
178 }
179  
180 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
181 4 ▶sub author { return $_[0]{properties}{author} }
Subroutine author: called CC=1 SCAR=0.0
182 4 ▶sub availability { return $_[0]{properties}{availability} }
Subroutine availability: called CC=1 SCAR=0.0
183 4 ▶sub config { return $_[0]{properties}{config} }
Subroutine config: called CC=1 SCAR=0.0
184 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
185 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
186 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
187 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
188 4 ▶sub operator_type { return $_[0]{properties}{operator_type} }
Subroutine operator_type: called CC=1 SCAR=0.0
189 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
190 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
191 4 ▶sub version { return $_[0]{properties}{version} }
Subroutine version: called CC=1 SCAR=0.0
192  
193 2 1;
194  
195 __END__
« Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeRegistrations/AuthRegistrationsCredentialListMapping.pm ↑ Summary Twilio/Rest/Taskrouter/V1/Workspace/Task/Reservation.pm »