Twilio/Rest/Proxy/V1/Service.pm

filter: Statementstmt 83.1% 94 / 113 Branchbran 100% 4 / 4 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.8% 38 / 47 Podpod n/a totaltotal 79.2% 141 / 178 CC 7 SCAR 3.4
CC
7
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/IpMessaging/V2/Service/User.pm ↑ Summary Twilio/Rest/FlexApi/V1/PluginConfiguration.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Proxy::V1::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::Proxy::V1::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 25 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 25 my ($class, $version) = @_;
17 25 my $self = $class->SUPER::new($version);
18 25 $self->{solution} = {};
19 25 $self->{uri} = '/Services';
20 25 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 CallbackUrl => $options->{callback_url},
30 ChatInstanceSid => $options->{chat_instance_sid},
31 DefaultTtl => $options->{default_ttl},
32 GeoMatchLevel => $options->{geo_match_level},
33 InterceptCallbackUrl => $options->{intercept_callback_url},
34 NumberSelectionBehavior => $options->{number_selection_behavior},
35 OutOfSessionCallbackUrl => $options->{out_of_session_callback_url},
36 1 };
37  
38 my $response =
39 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
40 1 return Twilio::Rest::Proxy::V1::ServiceInstance->new($self->{version}, $response->get_content);
41 }
42  
43 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
44 0 my ($self, @arguments) = @_;
45 0 return $self->read_records(@arguments);
46 }
47  
48 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
49 0 my ($self, @arguments) = @_;
50 0 return $self->stream_records(@arguments);
51 }
52  
53 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
54 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
55 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
56  
57 1 my $params = {
58 PageToken => $page_token,
59 Page => $page_number,
60 PageSize => $page_size,
61 };
62  
63 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
64 1 return $self->_build_page($response);
65 }
66  
67 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
68 0 my ($self, $target_url) = @_;
69 0 my $client = $self->{version}->get_domain->get_client;
70 0 return $self->_build_page($client->request('GET', $target_url));
71 }
72  
73 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
74 1 my ($self, $response) = @_;
75 1 return Twilio::Rest::Proxy::V1::ServicePage->new($self->{version}, $response, $self->{solution});
76 }
77  
78 23 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
79 23 my ($self, $sid) = @_;
80 23 return Twilio::Rest::Proxy::V1::ServiceContext->new($self->{version}, $sid);
81 }
82  
83 package Twilio::Rest::Proxy::V1::ServicePage;
84  
85 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'services' }
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 1 return Twilio::Rest::Proxy::V1::ServiceInstance->new($self->{version}, $payload);
92 }
93  
94 package Twilio::Rest::Proxy::V1::ServiceContext;
95  
96 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 23 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
101 23 my ($class, $version, $sid) = @_;
102 23 my $self = $class->SUPER::new($version);
103 23 $self->{solution} = { sid => $sid };
104 23 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
105 23 return $self;
106 }
107  
108 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
109 1 my ($self) = @_;
110 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
111 1 return 1;
112 }
113  
114 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
115 1 my ($self) = @_;
116  
117 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
118 1 return $self->_build_instance($response);
119 }
120  
121 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
122 1 my ($self, $options) = @_;
123 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
124  
125 my $data = {
126 CallbackUrl => $options->{callback_url},
127 ChatInstanceSid => $options->{chat_instance_sid},
128 DefaultTtl => $options->{default_ttl},
129 GeoMatchLevel => $options->{geo_match_level},
130 InterceptCallbackUrl => $options->{intercept_callback_url},
131 NumberSelectionBehavior => $options->{number_selection_behavior},
132 OutOfSessionCallbackUrl => $options->{out_of_session_callback_url},
133 UniqueName => $options->{unique_name},
134 1 };
135  
136 my $response =
137 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
138 1 return $self->_build_instance($response);
139 }
140  
141 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
142 2 my ($self, $response) = @_;
143 return Twilio::Rest::Proxy::V1::ServiceInstance->new($self->{version}, $response->get_content,
144 2 $self->{solution}{sid});
145 }
146  
147 5 ▶sub phone_numbers {
Subroutine phone_numbers: called CC=2 SCAR=6.9
148 5 my ($self, $sid) = @_;
149 5 require Twilio::Rest::Proxy::V1::Service::PhoneNumber;
150 my $list = Twilio::Rest::Proxy::V1::Service::PhoneNumberList->new($self->{version},
151 5 $self->{solution}{sid});
152 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
153 }
154  
155 15 ▶sub sessions {
Subroutine sessions: called CC=2 SCAR=6.9
156 15 my ($self, $sid) = @_;
157 15 require Twilio::Rest::Proxy::V1::Service::Session;
158 my $list =
159 15 Twilio::Rest::Proxy::V1::Service::SessionList->new($self->{version}, $self->{solution}{sid});
160 15 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 13 2 15
161 }
162  
163 package Twilio::Rest::Proxy::V1::ServiceInstance;
164  
165 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
166  
167 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
168  
169 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
170 4 my ($class, $version, $payload, $sid) = @_;
171 4 my $self = $class->SUPER::new($version, $payload);
172 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
173 4 return $self;
174 }
175  
176 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
177 0 my ($self, @arguments) = @_;
178 0 return $self->_context->delete(@arguments);
179 }
180  
181 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
182 0 my ($self, @arguments) = @_;
183 0 return $self->_context->fetch(@arguments);
184 }
185  
186 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
187 0 my ($self, @arguments) = @_;
188 0 return $self->_context->update(@arguments);
189 }
190  
191 0 ▶sub phone_numbers {
Subroutine phone_numbers: not called CC=1 SCAR=6.9
192 0 my ($self, @arguments) = @_;
193 0 return $self->_context->phone_numbers(@arguments);
194 }
195  
196 0 ▶sub sessions {
Subroutine sessions: not called CC=1 SCAR=6.9
197 0 my ($self, @arguments) = @_;
198 0 return $self->_context->sessions(@arguments);
199 }
200  
201 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
202 0 my ($self) = @_;
203 0 return Twilio::Rest::Proxy::V1::ServiceContext->new($self->{version}, $self->{solution}{sid});
204 }
205  
206 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
207 4 ▶sub callback_url { return $_[0]{properties}{callback_url} }
Subroutine callback_url: called CC=1 SCAR=0.0
208 4 ▶sub chat_instance_sid { return $_[0]{properties}{chat_instance_sid} }
Subroutine chat_instance_sid: called CC=1 SCAR=0.0
209 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
210 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
211 4 ▶sub default_ttl { return $_[0]{properties}{default_ttl} }
Subroutine default_ttl: called CC=1 SCAR=0.0
212 4 ▶sub geo_match_level { return $_[0]{properties}{geo_match_level} }
Subroutine geo_match_level: called CC=1 SCAR=0.0
213 4 ▶sub intercept_callback_url { return $_[0]{properties}{intercept_callback_url} }
Subroutine intercept_callback_url: called CC=1 SCAR=0.0
214 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
215 4 ▶sub number_selection_behavior { return $_[0]{properties}{number_selection_behavior} }
Subroutine number_selection_behavior: called CC=1 SCAR=0.0
216 4 ▶sub out_of_session_callback_url { return $_[0]{properties}{out_of_session_callback_url} }
Subroutine out_of_session_callback_url: called CC=1 SCAR=0.0
217 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
218 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
219 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
220  
221 2 1;
222  
223 __END__
« Twilio/Rest/IpMessaging/V2/Service/User.pm ↑ Summary Twilio/Rest/FlexApi/V1/PluginConfiguration.pm »