Twilio/Rest/Voice/V1/ByocTrunk.pm

filter: Statementstmt 85.2% 87 / 102 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 84.0% 37 / 44 Podpod n/a totaltotal 80.6% 129 / 160 CC 5 SCAR 2.7
CC
5
Cov
83%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Video/V1/CompositionHook.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Usage/Trigger.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Voice::V1::ByocTrunk;
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::Voice::V1::ByocTrunkList;
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} = '/ByocTrunks';
20 5 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 ConnectionPolicySid => $options->{connection_policy_sid},
30 FriendlyName => $options->{friendly_name},
31 FromDomainSid => $options->{from_domain_sid},
32 StatusCallbackMethod => $options->{status_callback_method},
33 StatusCallbackUrl => $options->{status_callback_url},
34 VoiceFallbackMethod => $options->{voice_fallback_method},
35 VoiceFallbackUrl => $options->{voice_fallback_url},
36 VoiceMethod => $options->{voice_method},
37 VoiceUrl => $options->{voice_url},
38 1 };
39  
40 my $response =
41 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
42 1 return Twilio::Rest::Voice::V1::ByocTrunkInstance->new($self->{version}, $response->get_content);
43 }
44  
45 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->read_records(@arguments);
48 }
49  
50 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
51 0 my ($self, @arguments) = @_;
52 0 return $self->stream_records(@arguments);
53 }
54  
55 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
56 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
57 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
58  
59 1 my $params = {
60 PageToken => $page_token,
61 Page => $page_number,
62 PageSize => $page_size,
63 };
64  
65 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
66 1 return $self->_build_page($response);
67 }
68  
69 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
70 0 my ($self, $target_url) = @_;
71 0 my $client = $self->{version}->get_domain->get_client;
72 0 return $self->_build_page($client->request('GET', $target_url));
73 }
74  
75 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
76 1 my ($self, $response) = @_;
77 return Twilio::Rest::Voice::V1::ByocTrunkPage->new($self->{version}, $response,
78 1 $self->{solution});
79 }
80  
81 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
82 3 my ($self, $sid) = @_;
83 3 return Twilio::Rest::Voice::V1::ByocTrunkContext->new($self->{version}, $sid);
84 }
85  
86 package Twilio::Rest::Voice::V1::ByocTrunkPage;
87  
88 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 1 ▶sub records_key { return 'byoc_trunks' }
Subroutine records_key: called CC=1 SCAR=0.0
91  
92 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
93 1 my ($self, $payload) = @_;
94 1 return Twilio::Rest::Voice::V1::ByocTrunkInstance->new($self->{version}, $payload);
95 }
96  
97 package Twilio::Rest::Voice::V1::ByocTrunkContext;
98  
99 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
104 3 my ($class, $version, $sid) = @_;
105 3 my $self = $class->SUPER::new($version);
106 3 $self->{solution} = { sid => $sid };
107 3 $self->{uri} = join q{}, '/ByocTrunks/', Twilio::Serialize::path_segment($sid);
108 3 return $self;
109 }
110  
111 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
112 1 my ($self) = @_;
113 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
114 1 return 1;
115 }
116  
117 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
118 1 my ($self) = @_;
119  
120 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
121 1 return $self->_build_instance($response);
122 }
123  
124 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
125 1 my ($self, $options) = @_;
126 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
127  
128 my $data = {
129 CnamLookupEnabled => Twilio::Serialize::boolean_to_string($options->{cnam_lookup_enabled}),
130 ConnectionPolicySid => $options->{connection_policy_sid},
131 FriendlyName => $options->{friendly_name},
132 FromDomainSid => $options->{from_domain_sid},
133 StatusCallbackMethod => $options->{status_callback_method},
134 StatusCallbackUrl => $options->{status_callback_url},
135 VoiceFallbackMethod => $options->{voice_fallback_method},
136 VoiceFallbackUrl => $options->{voice_fallback_url},
137 VoiceMethod => $options->{voice_method},
138 VoiceUrl => $options->{voice_url},
139 1 };
140  
141 my $response =
142 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
143 1 return $self->_build_instance($response);
144 }
145  
146 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
147 2 my ($self, $response) = @_;
148 return Twilio::Rest::Voice::V1::ByocTrunkInstance->new($self->{version}, $response->get_content,
149 2 $self->{solution}{sid});
150 }
151  
152 package Twilio::Rest::Voice::V1::ByocTrunkInstance;
153  
154 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
159 4 my ($class, $version, $payload, $sid) = @_;
160 4 my $self = $class->SUPER::new($version, $payload);
161 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
162 4 return $self;
163 }
164  
165 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->delete(@arguments);
168 }
169  
170 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
171 0 my ($self, @arguments) = @_;
172 0 return $self->_context->fetch(@arguments);
173 }
174  
175 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
176 0 my ($self, @arguments) = @_;
177 0 return $self->_context->update(@arguments);
178 }
179  
180 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
181 0 my ($self) = @_;
182 0 return Twilio::Rest::Voice::V1::ByocTrunkContext->new($self->{version}, $self->{solution}{sid});
183 }
184  
185 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
186 4 ▶sub cnam_lookup_enabled { return $_[0]{properties}{cnam_lookup_enabled} }
Subroutine cnam_lookup_enabled: called CC=1 SCAR=0.0
187 4 ▶sub connection_policy_sid { return $_[0]{properties}{connection_policy_sid} }
Subroutine connection_policy_sid: called CC=1 SCAR=0.0
188 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
189 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
190 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
191 4 ▶sub from_domain_sid { return $_[0]{properties}{from_domain_sid} }
Subroutine from_domain_sid: called CC=1 SCAR=0.0
192 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
193 4 ▶sub status_callback_method { return $_[0]{properties}{status_callback_method} }
Subroutine status_callback_method: called CC=1 SCAR=0.0
194 4 ▶sub status_callback_url { return $_[0]{properties}{status_callback_url} }
Subroutine status_callback_url: called CC=1 SCAR=0.0
195 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
196 4 ▶sub voice_fallback_method { return $_[0]{properties}{voice_fallback_method} }
Subroutine voice_fallback_method: called CC=1 SCAR=0.0
197 4 ▶sub voice_fallback_url { return $_[0]{properties}{voice_fallback_url} }
Subroutine voice_fallback_url: called CC=1 SCAR=0.0
198 4 ▶sub voice_method { return $_[0]{properties}{voice_method} }
Subroutine voice_method: called CC=1 SCAR=0.0
199 4 ▶sub voice_url { return $_[0]{properties}{voice_url} }
Subroutine voice_url: called CC=1 SCAR=0.0
200  
201 2 1;
202  
203 __END__
« Twilio/Rest/Video/V1/CompositionHook.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Usage/Trigger.pm »