Twilio/Rest/Chat/V1/Service/User.pm

filter: Statementstmt 83.9% 89 / 106 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 82.2% 37 / 45 Podpod n/a totaltotal 79.3% 131 / 165 CC 5 SCAR 2.8
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Supersim/V1/Sim.pm ↑ Summary Twilio/Rest/IpMessaging/V1/Service/User.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Chat::V1::Service::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::Chat::V1::Service::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 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 7 my ($class, $version, $service_sid) = @_;
17 7 my $self = $class->SUPER::new($version);
18 7 $self->{solution} = { service_sid => $service_sid };
19 7 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Users';
20 7 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $identity, $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 Identity => $identity,
29 Attributes => $options->{attributes},
30 FriendlyName => $options->{friendly_name},
31 RoleSid => $options->{role_sid},
32 1 };
33  
34 my $response =
35 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
36 return Twilio::Rest::Chat::V1::Service::UserInstance->new($self->{version},
37 1 $response->get_content, $self->{solution}{service_sid});
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
01
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
53  
54 1 my $params = {
55 PageToken => $page_token,
56 Page => $page_number,
57 PageSize => $page_size,
58 };
59  
60 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
61 1 return $self->_build_page($response);
62 }
63  
64 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
65 0 my ($self, $target_url) = @_;
66 0 my $client = $self->{version}->get_domain->get_client;
67 0 return $self->_build_page($client->request('GET', $target_url));
68 }
69  
70 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
71 1 my ($self, $response) = @_;
72 return Twilio::Rest::Chat::V1::Service::UserPage->new($self->{version}, $response,
73 1 $self->{solution});
74 }
75  
76 5 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
77 5 my ($self, $sid) = @_;
78 return Twilio::Rest::Chat::V1::Service::UserContext->new($self->{version},
79 5 $self->{solution}{service_sid}, $sid);
80 }
81  
82 package Twilio::Rest::Chat::V1::Service::UserPage;
83  
84 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 1 ▶sub records_key { return 'users' }
Subroutine records_key: called CC=1 SCAR=0.0
87  
88 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
89 1 my ($self, $payload) = @_;
90 return Twilio::Rest::Chat::V1::Service::UserInstance->new($self->{version}, $payload,
91 1 $self->{solution}{service_sid});
92 }
93  
94 package Twilio::Rest::Chat::V1::Service::UserContext;
95  
96 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
101 5 my ($class, $version, $service_sid, $sid) = @_;
102 5 my $self = $class->SUPER::new($version);
103 5 $self->{solution} = { service_sid => $service_sid, sid => $sid };
104 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Users/',
105 Twilio::Serialize::path_segment($sid);
106 5 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 Attributes => $options->{attributes},
128 FriendlyName => $options->{friendly_name},
129 RoleSid => $options->{role_sid},
130 1 };
131  
132 my $response =
133 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
134 1 return $self->_build_instance($response);
135 }
136  
137 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
138 2 my ($self, $response) = @_;
139 return Twilio::Rest::Chat::V1::Service::UserInstance->new(
140 $self->{version}, $response->get_content,
141 $self->{solution}{service_sid}, $self->{solution}{sid}
142 2 );
143 }
144  
145 2 ▶sub user_channels {
Subroutine user_channels: called CC=1 SCAR=0.0
146 2 my ($self) = @_;
147 2 require Twilio::Rest::Chat::V1::Service::User::UserChannel;
148 return Twilio::Rest::Chat::V1::Service::User::UserChannelList->new(
149 $self->{version},
150 $self->{solution}{service_sid},
151 $self->{solution}{sid}
152 2 );
153 }
154  
155 package Twilio::Rest::Chat::V1::Service::UserInstance;
156  
157 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
158  
159 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
160  
161 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
162 4 my ($class, $version, $payload, $service_sid, $sid) = @_;
163 4 my $self = $class->SUPER::new($version, $payload);
164 4 ▶ $self->{solution} = { service_sid => $service_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
165 4 return $self;
166 }
167  
168 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
169 0 my ($self, @arguments) = @_;
170 0 return $self->_context->delete(@arguments);
171 }
172  
173 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
174 0 my ($self, @arguments) = @_;
175 0 return $self->_context->fetch(@arguments);
176 }
177  
178 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
179 0 my ($self, @arguments) = @_;
180 0 return $self->_context->update(@arguments);
181 }
182  
183 0 ▶sub user_channels {
Subroutine user_channels: not called CC=1 SCAR=6.9
184 0 my ($self, @arguments) = @_;
185 0 return $self->_context->user_channels(@arguments);
186 }
187  
188 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
189 0 my ($self) = @_;
190 return Twilio::Rest::Chat::V1::Service::UserContext->new(
191 $self->{version},
192 $self->{solution}{service_sid},
193 $self->{solution}{sid}
194 0 );
195 }
196  
197 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
198 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
199 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
200 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
201 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
202 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
203 4 ▶sub is_notifiable { return $_[0]{properties}{is_notifiable} }
Subroutine is_notifiable: called CC=1 SCAR=0.0
204 4 ▶sub is_online { return $_[0]{properties}{is_online} }
Subroutine is_online: called CC=1 SCAR=0.0
205 4 ▶sub joined_channels_count { return $_[0]{properties}{joined_channels_count} }
Subroutine joined_channels_count: called CC=1 SCAR=0.0
206 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
207 4 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
208 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
209 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
210 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
211  
212 3 1;
213  
214 __END__
« Twilio/Rest/Supersim/V1/Sim.pm ↑ Summary Twilio/Rest/IpMessaging/V1/Service/User.pm »