Twilio/Rest/Trusthub/V1/CustomerProfiles.pm

filter: Statementstmt 82.2% 97 / 118 Branchbran 100% 6 / 6 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 79.1% 38 / 48 Podpod n/a totaltotal 78.4% 146 / 186 CC 8 SCAR 3.6
CC
8
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Trunking/V1/Trunk.pm ↑ Summary Twilio/Rest/Trusthub/V1/TrustProducts.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Trusthub::V1::CustomerProfiles;
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::Trusthub::V1::CustomerProfilesList;
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 16 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 16 my ($class, $version) = @_;
17 16 my $self = $class->SUPER::new($version);
18 16 $self->{solution} = {};
19 16 $self->{uri} = '/CustomerProfiles';
20 16 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $friendly_name, $email, $policy_sid, $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 FriendlyName => $friendly_name,
29 Email => $email,
30 PolicySid => $policy_sid,
31 StatusCallback => $options->{status_callback},
32 1 };
33  
34 my $response =
35 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
36 return Twilio::Rest::Trusthub::V1::CustomerProfilesInstance->new($self->{version},
37 1 $response->get_content);
38 }
39  
40 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
41 0 my ($self, @arguments) = @_;
42 0 return $self->read_records(@arguments);
43 }
44  
45 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->stream_records(@arguments);
48 }
49  
50 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
51 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
52 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
53  
54 my $params = {
55 FriendlyName => $options->{friendly_name},
56 PolicySid => $options->{policy_sid},
57 Status => $options->{status},
58 1 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 return Twilio::Rest::Trusthub::V1::CustomerProfilesPage->new($self->{version}, $response,
76 1 $self->{solution});
77 }
78  
79 14 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
80 14 my ($self, $sid) = @_;
81 14 return Twilio::Rest::Trusthub::V1::CustomerProfilesContext->new($self->{version}, $sid);
82 }
83  
84 package Twilio::Rest::Trusthub::V1::CustomerProfilesPage;
85  
86 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 1 ▶sub records_key { return 'results' }
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 1 return Twilio::Rest::Trusthub::V1::CustomerProfilesInstance->new($self->{version}, $payload);
93 }
94  
95 package Twilio::Rest::Trusthub::V1::CustomerProfilesContext;
96  
97 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 14 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 14 my ($class, $version, $sid) = @_;
103 14 my $self = $class->SUPER::new($version);
104 14 $self->{solution} = { sid => $sid };
105 14 $self->{uri} = join q{}, '/CustomerProfiles/', Twilio::Serialize::path_segment($sid);
106 14 return $self;
107 }
108  
109 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
110 1 my ($self) = @_;
111 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
112 1 return 1;
113 }
114  
115 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
116 1 my ($self) = @_;
117  
118 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
119 1 return $self->_build_instance($response);
120 }
121  
122 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
123 1 my ($self, $options) = @_;
124 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
125  
126 my $data = {
127 Email => $options->{email},
128 FriendlyName => $options->{friendly_name},
129 Status => $options->{status},
130 StatusCallback => $options->{status_callback},
131 1 };
132  
133 my $response =
134 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
135 1 return $self->_build_instance($response);
136 }
137  
138 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
139 2 my ($self, $response) = @_;
140 return Twilio::Rest::Trusthub::V1::CustomerProfilesInstance->new($self->{version},
141 2 $response->get_content, $self->{solution}{sid});
142 }
143  
144 4 ▶sub customer_profiles_channel_endpoint_assignment {
Subroutine customer_profiles_channel_endpoint_assignment: called CC=2 SCAR=6.9
145 4 my ($self, $sid) = @_;
146 4 require Twilio::Rest::Trusthub::V1::CustomerProfiles::CustomerProfilesChannelEndpointAssignment;
147 my $list =
148 Twilio::Rest::Trusthub::V1::CustomerProfiles::CustomerProfilesChannelEndpointAssignmentList
149 4 ->new($self->{version}, $self->{solution}{sid});
150 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
151 }
152  
153 4 ▶sub customer_profiles_entity_assignments {
Subroutine customer_profiles_entity_assignments: called CC=2 SCAR=6.9
154 4 my ($self, $sid) = @_;
155 4 require Twilio::Rest::Trusthub::V1::CustomerProfiles::CustomerProfilesEntityAssignments;
156 my $list =
157 Twilio::Rest::Trusthub::V1::CustomerProfiles::CustomerProfilesEntityAssignmentsList->new(
158 4 $self->{version}, $self->{solution}{sid});
159 4 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 2 4
160 }
161  
162 3 ▶sub customer_profiles_evaluations {
Subroutine customer_profiles_evaluations: called CC=2 SCAR=6.9
163 3 my ($self, $sid) = @_;
164 3 require Twilio::Rest::Trusthub::V1::CustomerProfiles::CustomerProfilesEvaluations;
165 my $list = Twilio::Rest::Trusthub::V1::CustomerProfiles::CustomerProfilesEvaluationsList->new(
166 3 $self->{version}, $self->{solution}{sid});
167 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 2 3
168 }
169  
170 package Twilio::Rest::Trusthub::V1::CustomerProfilesInstance;
171  
172 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
173  
174 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
175  
176 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
177 4 my ($class, $version, $payload, $sid) = @_;
178 4 my $self = $class->SUPER::new($version, $payload);
179 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
180 4 return $self;
181 }
182  
183 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
184 0 my ($self, @arguments) = @_;
185 0 return $self->_context->delete(@arguments);
186 }
187  
188 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
189 0 my ($self, @arguments) = @_;
190 0 return $self->_context->fetch(@arguments);
191 }
192  
193 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
194 0 my ($self, @arguments) = @_;
195 0 return $self->_context->update(@arguments);
196 }
197  
198 0 ▶sub customer_profiles_channel_endpoint_assignment {
Subroutine customer_profiles_channel_endpoint_assignment: not called CC=1 SCAR=6.9
199 0 my ($self, @arguments) = @_;
200 0 return $self->_context->customer_profiles_channel_endpoint_assignment(@arguments);
201 }
202  
203 0 ▶sub customer_profiles_entity_assignments {
Subroutine customer_profiles_entity_assignments: not called CC=1 SCAR=6.9
204 0 my ($self, @arguments) = @_;
205 0 return $self->_context->customer_profiles_entity_assignments(@arguments);
206 }
207  
208 0 ▶sub customer_profiles_evaluations {
Subroutine customer_profiles_evaluations: not called CC=1 SCAR=6.9
209 0 my ($self, @arguments) = @_;
210 0 return $self->_context->customer_profiles_evaluations(@arguments);
211 }
212  
213 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
214 0 my ($self) = @_;
215 return Twilio::Rest::Trusthub::V1::CustomerProfilesContext->new($self->{version},
216 0 $self->{solution}{sid});
217 }
218  
219 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
220 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
221 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
222 4 ▶sub email { return $_[0]{properties}{email} }
Subroutine email: called CC=1 SCAR=0.0
223 4 ▶sub errors { return $_[0]{properties}{errors} }
Subroutine errors: called CC=1 SCAR=0.0
224 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
225 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
226 4 ▶sub policy_sid { return $_[0]{properties}{policy_sid} }
Subroutine policy_sid: called CC=1 SCAR=0.0
227 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
228 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
229 4 ▶sub status_callback { return $_[0]{properties}{status_callback} }
Subroutine status_callback: called CC=1 SCAR=0.0
230 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
231 4 ▶sub valid_until { return Twilio::Deserialize::date_time($_[0]{properties}{valid_until}) }
Subroutine valid_until: called CC=1 SCAR=0.0
232  
233 2 1;
234  
235 __END__
« Twilio/Rest/Trunking/V1/Trunk.pm ↑ Summary Twilio/Rest/Trusthub/V1/TrustProducts.pm »