Twilio/Rest/PreviewIam/Versionless/Organization/User.pm

filter: Statementstmt 87.5% 91 / 104 Branchbran n/a Conditioncond 66.6% 6 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 85.7% 36 / 42 Podpod n/a totaltotal 83.7% 134 / 160 CC 5 SCAR 2.7
CC
5
Cov
86%
page
2.0
patch
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/FlexApi/V1/Assessments.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Call/Payment.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::PreviewIam::Versionless::Organization::User;
3  
4 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.001';
8  
9 package Twilio::Rest::PreviewIam::Versionless::Organization::UserList;
10  
11 3 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 8 my ($class, $version, $organization_sid) = @_;
17 8 my $self = $class->SUPER::new($version);
18 8 $self->{solution} = { organization_sid => $organization_sid };
19 8 $self->{uri} = join q{}, '/Organizations/', Twilio::Serialize::path_segment($organization_sid),
20 '/scim/Users';
21 8 return $self;
22 }
23  
24 2 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
25 2 my ($self, $body) = @_;
26  
27 2 my $data = Twilio::Serialize::json_body($body, { 'active' => 'boolean' });
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 2 'create',
33 {
34 data => $data,
35 headers => {
36 Accept => 'application/scim+json',
37 'Content-Type' => 'application/json',
38 }
39 }
40 );
41 return Twilio::Rest::PreviewIam::Versionless::Organization::UserInstance->new($self->{version},
42 2 $response->get_content, $self->{solution}{organization_sid});
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
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
58  
59 my $params = {
60 filter => $options->{filter},
61 1 PageToken => $page_token,
62 Page => $page_number,
63 PageSize => $page_size,
64 };
65  
66 my $response = $self->{version}->page(
67 'GET',
68 $self->{uri},
69 {
70 1 params => $params,
71 headers => { Accept => 'application/scim+json', }
72 }
73 );
74 1 return $self->_build_page($response);
75 }
76  
77 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
78 0 my ($self, $target_url) = @_;
79 0 my $client = $self->{version}->get_domain->get_client;
80 0 return $self->_build_page($client->request('GET', $target_url));
81 }
82  
83 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
84 1 my ($self, $response) = @_;
85 return Twilio::Rest::PreviewIam::Versionless::Organization::UserPage->new($self->{version},
86 1 $response, $self->{solution});
87 }
88  
89 5 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
90 5 my ($self, $user_sid) = @_;
91 return Twilio::Rest::PreviewIam::Versionless::Organization::UserContext->new($self->{version},
92 5 $self->{solution}{organization_sid}, $user_sid);
93 }
94  
95 package Twilio::Rest::PreviewIam::Versionless::Organization::UserPage;
96  
97 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 1 ▶sub records_key { return 'Resources' }
Subroutine records_key: called CC=1 SCAR=0.0
100  
101 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
102 1 my ($self, $payload) = @_;
103 return Twilio::Rest::PreviewIam::Versionless::Organization::UserInstance->new($self->{version},
104 1 $payload, $self->{solution}{organization_sid});
105 }
106  
107 package Twilio::Rest::PreviewIam::Versionless::Organization::UserContext;
108  
109 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
110  
111 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
112  
113 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
114 6 my ($class, $version, $organization_sid, $user_sid) = @_;
115 6 my $self = $class->SUPER::new($version);
116 6 $self->{solution} = { organization_sid => $organization_sid, user_sid => $user_sid };
117 6 $self->{uri} = join q{}, '/Organizations/', Twilio::Serialize::path_segment($organization_sid),
118 '/scim/Users/', Twilio::Serialize::path_segment($user_sid);
119 6 return $self;
120 }
121  
122 2 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
123 2 my ($self) = @_;
124 2 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
125 2 return 1;
126 }
127  
128 2 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
129 2 my ($self) = @_;
130  
131 2 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch',
132 { headers => { Accept => 'application/scim+json', } });
133 2 return $self->_build_instance($response);
134 }
135  
136 2 ▶sub patch {
Subroutine patch: called CC=2 SCAR=7.0
137 2 my ($self, $body, $options) = @_;
138 2 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
20
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
139  
140 2 my $data = Twilio::Serialize::json_body($body, {});
141  
142 my $response = $self->{version}->handle_request(
143 'PATCH',
144 $self->{uri},
145 'patch',
146 {
147 data => $data,
148 headers => {
149 Accept => 'application/scim+json',
150 'Content-Type' => 'application/json',
151 'If-Match' => $options->{if_match},
152 }
153 }
154 2 );
155 2 return $self->_build_instance($response);
156 }
157  
158 2 ▶sub update {
Subroutine update: called CC=2 SCAR=6.9
159 2 my ($self, $body, $options) = @_;
160 2 ▶ $options //= {};
Condition100%2/2
$options //= {}
l!l
11
MC/DC100%1/1
$options //= {}
$options
Truth table100%2/2
A
A= $options
Aresult
11
00
161  
162 2 my $data = Twilio::Serialize::json_body($body, { 'active' => 'boolean' });
163  
164 my $response = $self->{version}->handle_request(
165 'PUT',
166 $self->{uri},
167 'update',
168 {
169 data => $data,
170 headers => {
171 Accept => 'application/scim+json',
172 'Content-Type' => 'application/json',
173 'If-Match' => $options->{if_match},
174 }
175 }
176 2 );
177 2 return $self->_build_instance($response);
178 }
179  
180 6 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
181 6 my ($self, $response) = @_;
182 return Twilio::Rest::PreviewIam::Versionless::Organization::UserInstance->new(
183 $self->{version}, $response->get_content,
184 $self->{solution}{organization_sid},
185 $self->{solution}{user_sid}
186 6 );
187 }
188  
189 package Twilio::Rest::PreviewIam::Versionless::Organization::UserInstance;
190  
191 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
192  
193 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
194  
195 9 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
196 9 my ($class, $version, $payload, $organization_sid, $user_sid) = @_;
197 9 my $self = $class->SUPER::new($version, $payload);
198 $self->{solution} =
199 9 ▶ { organization_sid => $organization_sid, user_sid => $user_sid // $self->{properties}{id} };
Condition66%2/3
$user_sid // $self->{"properties"}{"id"}
l!l&&r!l&&!r
630
MC/DC0%0/2
$user_sid // $self->{"properties"}{"id"}
$user_sid $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $user_sidB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
200 9 return $self;
201 }
202  
203 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
204 0 my ($self, @arguments) = @_;
205 0 return $self->_context->delete(@arguments);
206 }
207  
208 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
209 1 my ($self, @arguments) = @_;
210 1 return $self->_context->fetch(@arguments);
211 }
212  
213 0 ▶sub patch {
Subroutine patch: not called CC=1 SCAR=6.9
214 0 my ($self, @arguments) = @_;
215 0 return $self->_context->patch(@arguments);
216 }
217  
218 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
219 0 my ($self, @arguments) = @_;
220 0 return $self->_context->update(@arguments);
221 }
222  
223 1 ▶sub _context {
Subroutine _context: called CC=1 SCAR=0.0
224 1 my ($self) = @_;
225 return Twilio::Rest::PreviewIam::Versionless::Organization::UserContext->new(
226 $self->{version},
227 $self->{solution}{organization_sid},
228 $self->{solution}{user_sid}
229 1 );
230 }
231  
232 5 ▶sub active { return $_[0]{properties}{active} }
Subroutine active: called CC=1 SCAR=0.0
233 5 ▶sub display_name { return $_[0]{properties}{displayName} }
Subroutine display_name: called CC=1 SCAR=0.0
234 5 ▶sub emails { return $_[0]{properties}{emails} }
Subroutine emails: called CC=1 SCAR=0.0
235 5 ▶sub external_id { return $_[0]{properties}{externalId} }
Subroutine external_id: called CC=1 SCAR=0.0
236 5 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
237 5 ▶sub locale { return $_[0]{properties}{locale} }
Subroutine locale: called CC=1 SCAR=0.0
238 5 ▶sub meta { return $_[0]{properties}{meta} }
Subroutine meta: called CC=1 SCAR=0.0
239 5 ▶sub name { return $_[0]{properties}{name} }
Subroutine name: called CC=1 SCAR=0.0
240 5 ▶sub schemas { return $_[0]{properties}{schemas} }
Subroutine schemas: called CC=1 SCAR=0.0
241 5 ▶sub timezone { return $_[0]{properties}{timezone} }
Subroutine timezone: called CC=1 SCAR=0.0
242 5 ▶sub user_name { return $_[0]{properties}{userName} }
Subroutine user_name: called CC=1 SCAR=0.0
243  
244 3 1;
245  
246 __END__
« Twilio/Rest/FlexApi/V1/Assessments.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Call/Payment.pm »