Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTarget.pm

filter: Statementstmt 84.6% 83 / 98 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 82.5% 33 / 40 Podpod n/a totaltotal 79.6% 121 / 152 CC 5 SCAR 2.9
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/IpMessaging/V1/Service/Channel/Member.pm ↑ Summary Twilio/Rest/Serverless/V1/Service/Asset.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTarget;
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::ConnectionPolicy::ConnectionPolicyTargetList;
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, $connection_policy_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { connection_policy_sid => $connection_policy_sid };
19 5 $self->{uri} = join q{}, '/ConnectionPolicies/',
20 Twilio::Serialize::path_segment($connection_policy_sid), '/Targets';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $target, $options) = @_;
26 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
27  
28 my $data = {
29 Target => $target,
30 Enabled => Twilio::Serialize::boolean_to_string($options->{enabled}),
31 FriendlyName => $options->{friendly_name},
32 Priority => $options->{priority},
33 Weight => $options->{weight},
34 1 };
35  
36 my $response =
37 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
38 return Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetInstance->new(
39 1 $self->{version}, $response->get_content, $self->{solution}{connection_policy_sid});
40 }
41  
42 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
43 0 my ($self, @arguments) = @_;
44 0 return $self->read_records(@arguments);
45 }
46  
47 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->stream_records(@arguments);
50 }
51  
52 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
53 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
54 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
55  
56 1 my $params = {
57 PageToken => $page_token,
58 Page => $page_number,
59 PageSize => $page_size,
60 };
61  
62 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
63 1 return $self->_build_page($response);
64 }
65  
66 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
67 0 my ($self, $target_url) = @_;
68 0 my $client = $self->{version}->get_domain->get_client;
69 0 return $self->_build_page($client->request('GET', $target_url));
70 }
71  
72 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
73 1 my ($self, $response) = @_;
74 return Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetPage->new(
75 1 $self->{version}, $response, $self->{solution});
76 }
77  
78 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
79 3 my ($self, $sid) = @_;
80 return Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetContext->new(
81 3 $self->{version}, $self->{solution}{connection_policy_sid}, $sid);
82 }
83  
84 package Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetPage;
85  
86 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 1 ▶sub records_key { return 'targets' }
Subroutine records_key: called CC=1 SCAR=0.0
89  
90 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
91 1 my ($self, $payload) = @_;
92 return Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetInstance->new(
93 1 $self->{version}, $payload, $self->{solution}{connection_policy_sid});
94 }
95  
96 package Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetContext;
97  
98 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
103 3 my ($class, $version, $connection_policy_sid, $sid) = @_;
104 3 my $self = $class->SUPER::new($version);
105 3 $self->{solution} = { connection_policy_sid => $connection_policy_sid, sid => $sid };
106 3 $self->{uri} = join q{}, '/ConnectionPolicies/',
107 Twilio::Serialize::path_segment($connection_policy_sid), '/Targets/',
108 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 Enabled => Twilio::Serialize::boolean_to_string($options->{enabled}),
131 FriendlyName => $options->{friendly_name},
132 Priority => $options->{priority},
133 Target => $options->{target},
134 Weight => $options->{weight},
135 1 };
136  
137 my $response =
138 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
139 1 return $self->_build_instance($response);
140 }
141  
142 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
143 2 my ($self, $response) = @_;
144 return Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetInstance->new(
145 $self->{version}, $response->get_content,
146 $self->{solution}{connection_policy_sid},
147 $self->{solution}{sid}
148 2 );
149 }
150  
151 package Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetInstance;
152  
153 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
154  
155 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
158 4 my ($class, $version, $payload, $connection_policy_sid, $sid) = @_;
159 4 my $self = $class->SUPER::new($version, $payload);
160 $self->{solution} =
161 4 ▶ { connection_policy_sid => $connection_policy_sid, 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 return Twilio::Rest::Voice::V1::ConnectionPolicy::ConnectionPolicyTargetContext->new(
183 $self->{version},
184 $self->{solution}{connection_policy_sid},
185 $self->{solution}{sid}
186 0 );
187 }
188  
189 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
190 4 ▶sub connection_policy_sid { return $_[0]{properties}{connection_policy_sid} }
Subroutine connection_policy_sid: called CC=1 SCAR=0.0
191 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
192 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
193 4 ▶sub enabled { return $_[0]{properties}{enabled} }
Subroutine enabled: called CC=1 SCAR=0.0
194 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
195 4 ▶sub priority { return $_[0]{properties}{priority} }
Subroutine priority: called CC=1 SCAR=0.0
196 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
197 4 ▶sub target { return $_[0]{properties}{target} }
Subroutine target: called CC=1 SCAR=0.0
198 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
199 4 ▶sub weight { return $_[0]{properties}{weight} }
Subroutine weight: called CC=1 SCAR=0.0
200  
201 2 1;
202  
203 __END__
« Twilio/Rest/IpMessaging/V1/Service/Channel/Member.pm ↑ Summary Twilio/Rest/Serverless/V1/Service/Asset.pm »