Twilio/Rest/Intelligence/V2/Service.pm

filter: Statementstmt 85.5% 89 / 104 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 84.7% 39 / 46 Podpod n/a totaltotal 81.1% 133 / 164 CC 5 SCAR 2.6
CC
5
Cov
83%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Chat/V2/Service/Channel/Invite.pm ↑ Summary Twilio/Rest/IpMessaging/V1/Service/Channel/Invite.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Intelligence::V2::Service;
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::ServiceList;
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} = '/Services';
20 5 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $unique_name, $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 UniqueName => $unique_name,
29 AutoRedaction => Twilio::Serialize::boolean_to_string($options->{auto_redaction}),
30 AutoTranscribe => Twilio::Serialize::boolean_to_string($options->{auto_transcribe}),
31 DataLogging => Twilio::Serialize::boolean_to_string($options->{data_logging}),
32 EncryptionCredentialSid => $options->{encryption_credential_sid},
33 FriendlyName => $options->{friendly_name},
34 LanguageCode => $options->{language_code},
35 MediaRedaction => Twilio::Serialize::boolean_to_string($options->{media_redaction}),
36 WebhookHttpMethod => $options->{webhook_http_method},
37 WebhookUrl => $options->{webhook_url},
38 1 };
39  
40 my $response =
41 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
42 return Twilio::Rest::Intelligence::V2::ServiceInstance->new($self->{version},
43 1 $response->get_content);
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
01
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
59  
60 1 my $params = {
61 PageToken => $page_token,
62 Page => $page_number,
63 PageSize => $page_size,
64 };
65  
66 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
67 1 return $self->_build_page($response);
68 }
69  
70 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
71 0 my ($self, $target_url) = @_;
72 0 my $client = $self->{version}->get_domain->get_client;
73 0 return $self->_build_page($client->request('GET', $target_url));
74 }
75  
76 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
77 1 my ($self, $response) = @_;
78 return Twilio::Rest::Intelligence::V2::ServicePage->new($self->{version}, $response,
79 1 $self->{solution});
80 }
81  
82 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
83 3 my ($self, $sid) = @_;
84 3 return Twilio::Rest::Intelligence::V2::ServiceContext->new($self->{version}, $sid);
85 }
86  
87 package Twilio::Rest::Intelligence::V2::ServicePage;
88  
89 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 1 ▶sub records_key { return 'services' }
Subroutine records_key: called CC=1 SCAR=0.0
92  
93 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
94 1 my ($self, $payload) = @_;
95 1 return Twilio::Rest::Intelligence::V2::ServiceInstance->new($self->{version}, $payload);
96 }
97  
98 package Twilio::Rest::Intelligence::V2::ServiceContext;
99  
100 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
105 3 my ($class, $version, $sid) = @_;
106 3 my $self = $class->SUPER::new($version);
107 3 $self->{solution} = { sid => $sid };
108 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
109 3 return $self;
110 }
111  
112 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
113 1 my ($self) = @_;
114 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
115 1 return 1;
116 }
117  
118 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
119 1 my ($self) = @_;
120  
121 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
122 1 return $self->_build_instance($response);
123 }
124  
125 1 ▶sub update {
Subroutine update: 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  
129 my $data = {
130 AutoRedaction => Twilio::Serialize::boolean_to_string($options->{auto_redaction}),
131 AutoTranscribe => Twilio::Serialize::boolean_to_string($options->{auto_transcribe}),
132 DataLogging => Twilio::Serialize::boolean_to_string($options->{data_logging}),
133 EncryptionCredentialSid => $options->{encryption_credential_sid},
134 FriendlyName => $options->{friendly_name},
135 MediaRedaction => Twilio::Serialize::boolean_to_string($options->{media_redaction}),
136 UniqueName => $options->{unique_name},
137 WebhookHttpMethod => $options->{webhook_http_method},
138 WebhookUrl => $options->{webhook_url},
139 1 };
140  
141 my $response = $self->{version}->handle_request(
142 'POST',
143 $self->{uri},
144 'update',
145 {
146 data => $data,
147 headers => { 'If-Match' => $options->{if_match}, }
148 }
149 1 );
150 1 return $self->_build_instance($response);
151 }
152  
153 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
154 2 my ($self, $response) = @_;
155 return Twilio::Rest::Intelligence::V2::ServiceInstance->new($self->{version},
156 2 $response->get_content, $self->{solution}{sid});
157 }
158  
159 package Twilio::Rest::Intelligence::V2::ServiceInstance;
160  
161 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
162  
163 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
164  
165 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
166 4 my ($class, $version, $payload, $sid) = @_;
167 4 my $self = $class->SUPER::new($version, $payload);
168 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
169 4 return $self;
170 }
171  
172 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
173 0 my ($self, @arguments) = @_;
174 0 return $self->_context->delete(@arguments);
175 }
176  
177 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->fetch(@arguments);
180 }
181  
182 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->update(@arguments);
185 }
186  
187 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
188 0 my ($self) = @_;
189 return Twilio::Rest::Intelligence::V2::ServiceContext->new($self->{version},
190 0 $self->{solution}{sid});
191 }
192  
193 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
194 4 ▶sub auto_redaction { return $_[0]{properties}{auto_redaction} }
Subroutine auto_redaction: called CC=1 SCAR=0.0
195 4 ▶sub auto_transcribe { return $_[0]{properties}{auto_transcribe} }
Subroutine auto_transcribe: called CC=1 SCAR=0.0
196 4 ▶sub data_logging { return $_[0]{properties}{data_logging} }
Subroutine data_logging: called CC=1 SCAR=0.0
197 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
198 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
199 4 ▶sub encryption_credential_sid { return $_[0]{properties}{encryption_credential_sid} }
Subroutine encryption_credential_sid: called CC=1 SCAR=0.0
200 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
201 4 ▶sub language_code { return $_[0]{properties}{language_code} }
Subroutine language_code: called CC=1 SCAR=0.0
202 4 ▶sub media_redaction { return $_[0]{properties}{media_redaction} }
Subroutine media_redaction: called CC=1 SCAR=0.0
203 4 ▶sub read_only_attached_operator_sids { return $_[0]{properties}{read_only_attached_operator_sids} }
Subroutine read_only_attached_operator_sids: called CC=1 SCAR=0.0
204 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
205 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
206 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
207 4 ▶sub version { return $_[0]{properties}{version} }
Subroutine version: called CC=1 SCAR=0.0
208 4 ▶sub webhook_http_method { return $_[0]{properties}{webhook_http_method} }
Subroutine webhook_http_method: called CC=1 SCAR=0.0
209 4 ▶sub webhook_url { return $_[0]{properties}{webhook_url} }
Subroutine webhook_url: called CC=1 SCAR=0.0
210  
211 2 1;
212  
213 __END__
« Twilio/Rest/Chat/V2/Service/Channel/Invite.pm ↑ Summary Twilio/Rest/IpMessaging/V1/Service/Channel/Invite.pm »