Twilio/Rest/Trunking/V1/Trunk.pm

filter: Statementstmt 81.3% 109 / 134 Branchbran 100% 8 / 8 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 78.9% 45 / 57 Podpod n/a totaltotal 78.4% 167 / 213 CC 9 SCAR 3.6
CC
9
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Taskrouter/V1/Workspace/Worker.pm ↑ Summary Twilio/Rest/Trusthub/V1/CustomerProfiles.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Trunking::V1::Trunk;
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::Trunking::V1::TrunkList;
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 24 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 24 my ($class, $version) = @_;
17 24 my $self = $class->SUPER::new($version);
18 24 $self->{solution} = {};
19 24 $self->{uri} = '/Trunks';
20 24 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $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 CnamLookupEnabled => Twilio::Serialize::boolean_to_string($options->{cnam_lookup_enabled}),
29 DisasterRecoveryMethod => $options->{disaster_recovery_method},
30 DisasterRecoveryUrl => $options->{disaster_recovery_url},
31 DomainName => $options->{domain_name},
32 FriendlyName => $options->{friendly_name},
33 Secure => Twilio::Serialize::boolean_to_string($options->{secure}),
34 TransferCallerId => $options->{transfer_caller_id},
35 TransferMode => $options->{transfer_mode},
36 1 };
37  
38 my $response =
39 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
40 1 return Twilio::Rest::Trunking::V1::TrunkInstance->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::Trunking::V1::TrunkPage->new($self->{version}, $response, $self->{solution});
76 }
77  
78 22 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
79 22 my ($self, $sid) = @_;
80 22 return Twilio::Rest::Trunking::V1::TrunkContext->new($self->{version}, $sid);
81 }
82  
83 package Twilio::Rest::Trunking::V1::TrunkPage;
84  
85 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'trunks' }
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::Trunking::V1::TrunkInstance->new($self->{version}, $payload);
92 }
93  
94 package Twilio::Rest::Trunking::V1::TrunkContext;
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 22 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
101 22 my ($class, $version, $sid) = @_;
102 22 my $self = $class->SUPER::new($version);
103 22 $self->{solution} = { sid => $sid };
104 22 $self->{uri} = join q{}, '/Trunks/', Twilio::Serialize::path_segment($sid);
105 22 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 CnamLookupEnabled => Twilio::Serialize::boolean_to_string($options->{cnam_lookup_enabled}),
127 DisasterRecoveryMethod => $options->{disaster_recovery_method},
128 DisasterRecoveryUrl => $options->{disaster_recovery_url},
129 DomainName => $options->{domain_name},
130 FriendlyName => $options->{friendly_name},
131 Secure => Twilio::Serialize::boolean_to_string($options->{secure}),
132 TransferCallerId => $options->{transfer_caller_id},
133 TransferMode => $options->{transfer_mode},
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::Trunking::V1::TrunkInstance->new($self->{version}, $response->get_content,
144 2 $self->{solution}{sid});
145 }
146  
147 4 ▶sub credentials_lists {
Subroutine credentials_lists: called CC=2 SCAR=6.9
148 4 my ($self, $sid) = @_;
149 4 require Twilio::Rest::Trunking::V1::Trunk::CredentialList;
150 my $list = Twilio::Rest::Trunking::V1::Trunk::CredentialListList->new($self->{version},
151 4 $self->{solution}{sid});
152 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
153 }
154  
155 4 ▶sub ip_access_control_lists {
Subroutine ip_access_control_lists: called CC=2 SCAR=6.9
156 4 my ($self, $sid) = @_;
157 4 require Twilio::Rest::Trunking::V1::Trunk::IpAccessControlList;
158 my $list = Twilio::Rest::Trunking::V1::Trunk::IpAccessControlListList->new($self->{version},
159 4 $self->{solution}{sid});
160 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
161 }
162  
163 5 ▶sub origination_urls {
Subroutine origination_urls: called CC=2 SCAR=6.9
164 5 my ($self, $sid) = @_;
165 5 require Twilio::Rest::Trunking::V1::Trunk::OriginationUrl;
166 my $list = Twilio::Rest::Trunking::V1::Trunk::OriginationUrlList->new($self->{version},
167 5 $self->{solution}{sid});
168 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
169 }
170  
171 4 ▶sub phone_numbers {
Subroutine phone_numbers: called CC=2 SCAR=6.9
172 4 my ($self, $sid) = @_;
173 4 require Twilio::Rest::Trunking::V1::Trunk::PhoneNumber;
174 my $list = Twilio::Rest::Trunking::V1::Trunk::PhoneNumberList->new($self->{version},
175 4 $self->{solution}{sid});
176 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
177 }
178  
179 2 ▶sub recordings {
Subroutine recordings: called CC=1 SCAR=0.0
180 2 my ($self) = @_;
181 2 require Twilio::Rest::Trunking::V1::Trunk::Recording;
182 return Twilio::Rest::Trunking::V1::Trunk::RecordingContext->new($self->{version},
183 2 $self->{solution}{sid});
184 }
185  
186 package Twilio::Rest::Trunking::V1::TrunkInstance;
187  
188 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
189  
190 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
191  
192 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
193 4 my ($class, $version, $payload, $sid) = @_;
194 4 my $self = $class->SUPER::new($version, $payload);
195 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
196 4 return $self;
197 }
198  
199 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
200 0 my ($self, @arguments) = @_;
201 0 return $self->_context->delete(@arguments);
202 }
203  
204 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
205 0 my ($self, @arguments) = @_;
206 0 return $self->_context->fetch(@arguments);
207 }
208  
209 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
210 0 my ($self, @arguments) = @_;
211 0 return $self->_context->update(@arguments);
212 }
213  
214 0 ▶sub credentials_lists {
Subroutine credentials_lists: not called CC=1 SCAR=6.9
215 0 my ($self, @arguments) = @_;
216 0 return $self->_context->credentials_lists(@arguments);
217 }
218  
219 0 ▶sub ip_access_control_lists {
Subroutine ip_access_control_lists: not called CC=1 SCAR=6.9
220 0 my ($self, @arguments) = @_;
221 0 return $self->_context->ip_access_control_lists(@arguments);
222 }
223  
224 0 ▶sub origination_urls {
Subroutine origination_urls: not called CC=1 SCAR=6.9
225 0 my ($self, @arguments) = @_;
226 0 return $self->_context->origination_urls(@arguments);
227 }
228  
229 0 ▶sub phone_numbers {
Subroutine phone_numbers: not called CC=1 SCAR=6.9
230 0 my ($self, @arguments) = @_;
231 0 return $self->_context->phone_numbers(@arguments);
232 }
233  
234 0 ▶sub recordings {
Subroutine recordings: not called CC=1 SCAR=6.9
235 0 my ($self, @arguments) = @_;
236 0 return $self->_context->recordings(@arguments);
237 }
238  
239 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
240 0 my ($self) = @_;
241 0 return Twilio::Rest::Trunking::V1::TrunkContext->new($self->{version}, $self->{solution}{sid});
242 }
243  
244 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
245 4 ▶sub auth_type { return $_[0]{properties}{auth_type} }
Subroutine auth_type: called CC=1 SCAR=0.0
246 4 ▶sub auth_type_set { return $_[0]{properties}{auth_type_set} }
Subroutine auth_type_set: called CC=1 SCAR=0.0
247 4 ▶sub cnam_lookup_enabled { return $_[0]{properties}{cnam_lookup_enabled} }
Subroutine cnam_lookup_enabled: called CC=1 SCAR=0.0
248 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
249 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
250 4 ▶sub disaster_recovery_method { return $_[0]{properties}{disaster_recovery_method} }
Subroutine disaster_recovery_method: called CC=1 SCAR=0.0
251 4 ▶sub disaster_recovery_url { return $_[0]{properties}{disaster_recovery_url} }
Subroutine disaster_recovery_url: called CC=1 SCAR=0.0
252 4 ▶sub domain_name { return $_[0]{properties}{domain_name} }
Subroutine domain_name: called CC=1 SCAR=0.0
253 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
254 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
255 4 ▶sub recording { return $_[0]{properties}{recording} }
Subroutine recording: called CC=1 SCAR=0.0
256 4 ▶sub secure { return $_[0]{properties}{secure} }
Subroutine secure: called CC=1 SCAR=0.0
257 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
258 4 ▶sub symmetric_rtp_enabled { return $_[0]{properties}{symmetric_rtp_enabled} }
Subroutine symmetric_rtp_enabled: called CC=1 SCAR=0.0
259 4 ▶sub transfer_caller_id { return $_[0]{properties}{transfer_caller_id} }
Subroutine transfer_caller_id: called CC=1 SCAR=0.0
260 4 ▶sub transfer_mode { return $_[0]{properties}{transfer_mode} }
Subroutine transfer_mode: called CC=1 SCAR=0.0
261 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
262  
263 2 1;
264  
265 __END__
« Twilio/Rest/Taskrouter/V1/Workspace/Worker.pm ↑ Summary Twilio/Rest/Trusthub/V1/CustomerProfiles.pm »