Twilio/Rest/Api/V2010/Account/Sip/CredentialList/Credential.pm

filter: Statementstmt 83.8% 78 / 93 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.5% 29 / 36 Podpod n/a totaltotal 79.2% 111 / 140 CC 4 SCAR 2.9
CC
4
Cov
82%
page
2.0
update
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Intelligence/V2/Transcript.pm ↑ Summary Twilio/Rest/Studio/V2/Flow/Execution.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Api::V2010::Account::Sip::CredentialList::Credential;
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::Api::V2010::Account::Sip::CredentialList::CredentialList;
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, $account_sid, $credential_list_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { account_sid => $account_sid, credential_list_sid => $credential_list_sid };
19 5 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
20 '/SIP/CredentialLists/', Twilio::Serialize::path_segment($credential_list_sid),
21 '/Credentials.json';
22 5 return $self;
23 }
24  
25 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
26 1 my ($self, $username, $password) = @_;
27  
28 1 my $data = {
29 Username => $username,
30 Password => $password,
31 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialInstance->new(
36 $self->{version}, $response->get_content,
37 $self->{solution}{account_sid},
38 $self->{solution}{credential_list_sid}
39 1 );
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::Api::V2010::Account::Sip::CredentialList::CredentialPage->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::Api::V2010::Account::Sip::CredentialList::CredentialContext->new(
81 $self->{version},
82 $self->{solution}{account_sid},
83 3 $self->{solution}{credential_list_sid}, $sid
84 );
85 }
86  
87 package Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialPage;
88  
89 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 1 ▶sub records_key { return 'credentials' }
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 return Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialInstance->new(
96 $self->{version}, $payload,
97 $self->{solution}{account_sid},
98 $self->{solution}{credential_list_sid}
99 1 );
100 }
101  
102 package Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialContext;
103  
104 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
105  
106 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
107  
108 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
109 3 my ($class, $version, $account_sid, $credential_list_sid, $sid) = @_;
110 3 my $self = $class->SUPER::new($version);
111 $self->{solution} =
112 3 { account_sid => $account_sid, credential_list_sid => $credential_list_sid, sid => $sid };
113 3 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
114 '/SIP/CredentialLists/', Twilio::Serialize::path_segment($credential_list_sid),
115 '/Credentials/', Twilio::Serialize::path_segment($sid), '.json';
116 3 return $self;
117 }
118  
119 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
120 1 my ($self) = @_;
121 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
122 1 return 1;
123 }
124  
125 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
126 1 my ($self) = @_;
127  
128 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
129 1 return $self->_build_instance($response);
130 }
131  
132 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
133 1 my ($self, $options) = @_;
134 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
135  
136 1 my $data = { Password => $options->{password}, };
137  
138 my $response =
139 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
140 1 return $self->_build_instance($response);
141 }
142  
143 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
144 2 my ($self, $response) = @_;
145 return Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialInstance->new(
146 $self->{version}, $response->get_content,
147 $self->{solution}{account_sid},
148 $self->{solution}{credential_list_sid},
149 $self->{solution}{sid}
150 2 );
151 }
152  
153 package Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialInstance;
154  
155 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
158  
159 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
160 4 my ($class, $version, $payload, $account_sid, $credential_list_sid, $sid) = @_;
161 4 my $self = $class->SUPER::new($version, $payload);
162 $self->{solution} = {
163 account_sid => $account_sid,
164 credential_list_sid => $credential_list_sid,
165 sid => $sid // $self->{properties}{sid}
166 4 ▶ };
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
167 4 return $self;
168 }
169  
170 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
171 0 my ($self, @arguments) = @_;
172 0 return $self->_context->delete(@arguments);
173 }
174  
175 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
176 0 my ($self, @arguments) = @_;
177 0 return $self->_context->fetch(@arguments);
178 }
179  
180 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
181 0 my ($self, @arguments) = @_;
182 0 return $self->_context->update(@arguments);
183 }
184  
185 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
186 0 my ($self) = @_;
187 return Twilio::Rest::Api::V2010::Account::Sip::CredentialList::CredentialContext->new(
188 $self->{version},
189 $self->{solution}{account_sid},
190 $self->{solution}{credential_list_sid},
191 $self->{solution}{sid}
192 0 );
193 }
194  
195 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
196 4 ▶sub credential_list_sid { return $_[0]{properties}{credential_list_sid} }
Subroutine credential_list_sid: 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 sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
200 4 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
201 4 ▶sub username { return $_[0]{properties}{username} }
Subroutine username: called CC=1 SCAR=0.0
202  
203 2 1;
204  
205 __END__
« Twilio/Rest/Intelligence/V2/Transcript.pm ↑ Summary Twilio/Rest/Studio/V2/Flow/Execution.pm »