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

filter: Statementstmt 84.1% 90 / 107 Branchbran 100% 2 / 2 Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 81.8% 36 / 44 Podpod n/a totaltotal 78.8% 134 / 170 CC 7 SCAR 3.4
CC
7
Cov
82%
delete
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Verify/V2/Service/RateLimit.pm ↑ Summary Twilio/Rest/Conversations/V1/User.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::Service::User;
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::Conversations::V1::Service::UserList;
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 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 9 my ($class, $version, $chat_service_sid) = @_;
17 9 my $self = $class->SUPER::new($version);
18 9 $self->{solution} = { chat_service_sid => $chat_service_sid };
19 9 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
20 '/Users';
21 9 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $identity, $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 Identity => $identity,
30 Attributes => $options->{attributes},
31 FriendlyName => $options->{friendly_name},
32 RoleSid => $options->{role_sid},
33 1 };
34  
35 my $response = $self->{version}->handle_request(
36 'POST',
37 $self->{uri},
38 'create',
39 {
40 data => $data,
41 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
42 }
43 1 );
44 return Twilio::Rest::Conversations::V1::Service::UserInstance->new($self->{version},
45 1 $response->get_content, $self->{solution}{chat_service_sid});
46 }
47  
48 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
49 0 my ($self, @arguments) = @_;
50 0 return $self->read_records(@arguments);
51 }
52  
53 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
54 0 my ($self, @arguments) = @_;
55 0 return $self->stream_records(@arguments);
56 }
57  
58 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
59 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
60 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
61  
62 1 my $params = {
63 PageToken => $page_token,
64 Page => $page_number,
65 PageSize => $page_size,
66 };
67  
68 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
69 1 return $self->_build_page($response);
70 }
71  
72 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
73 0 my ($self, $target_url) = @_;
74 0 my $client = $self->{version}->get_domain->get_client;
75 0 return $self->_build_page($client->request('GET', $target_url));
76 }
77  
78 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
79 1 my ($self, $response) = @_;
80 return Twilio::Rest::Conversations::V1::Service::UserPage->new($self->{version}, $response,
81 1 $self->{solution});
82 }
83  
84 7 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
85 7 my ($self, $sid) = @_;
86 return Twilio::Rest::Conversations::V1::Service::UserContext->new($self->{version},
87 7 $self->{solution}{chat_service_sid}, $sid);
88 }
89  
90 package Twilio::Rest::Conversations::V1::Service::UserPage;
91  
92 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 1 ▶sub records_key { return 'users' }
Subroutine records_key: called CC=1 SCAR=0.0
95  
96 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
97 1 my ($self, $payload) = @_;
98 return Twilio::Rest::Conversations::V1::Service::UserInstance->new($self->{version}, $payload,
99 1 $self->{solution}{chat_service_sid});
100 }
101  
102 package Twilio::Rest::Conversations::V1::Service::UserContext;
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 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
109 7 my ($class, $version, $chat_service_sid, $sid) = @_;
110 7 my $self = $class->SUPER::new($version);
111 7 $self->{solution} = { chat_service_sid => $chat_service_sid, sid => $sid };
112 7 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
113 '/Users/', Twilio::Serialize::path_segment($sid);
114 7 return $self;
115 }
116  
117 1 ▶sub delete {
Subroutine delete: called CC=2 SCAR=7.0
118 1 my ($self, $options) = @_;
119 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
120 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
121 1 { headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, } });
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 my $data = {
137 Attributes => $options->{attributes},
138 FriendlyName => $options->{friendly_name},
139 RoleSid => $options->{role_sid},
140 1 };
141  
142 my $response = $self->{version}->handle_request(
143 'POST',
144 $self->{uri},
145 'update',
146 {
147 data => $data,
148 headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, }
149 }
150 1 );
151 1 return $self->_build_instance($response);
152 }
153  
154 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
155 2 my ($self, $response) = @_;
156 return Twilio::Rest::Conversations::V1::Service::UserInstance->new(
157 $self->{version}, $response->get_content,
158 $self->{solution}{chat_service_sid},
159 $self->{solution}{sid}
160 2 );
161 }
162  
163 4 ▶sub user_conversations {
Subroutine user_conversations: called CC=2 SCAR=6.9
164 4 my ($self, $conversation_sid) = @_;
165 4 require Twilio::Rest::Conversations::V1::Service::User::UserConversation;
166 my $list = Twilio::Rest::Conversations::V1::Service::User::UserConversationList->new(
167 $self->{version},
168 $self->{solution}{chat_service_sid},
169 $self->{solution}{sid}
170 4 );
171 4 ▶ return defined $conversation_sid ? $list->get_context($conversation_sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $conversation_sid ? : 3 1 4
172 }
173  
174 package Twilio::Rest::Conversations::V1::Service::UserInstance;
175  
176 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
177  
178 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
179  
180 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
181 4 my ($class, $version, $payload, $chat_service_sid, $sid) = @_;
182 4 my $self = $class->SUPER::new($version, $payload);
183 $self->{solution} =
184 4 ▶ { chat_service_sid => $chat_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
185 4 return $self;
186 }
187  
188 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
189 0 my ($self, @arguments) = @_;
190 0 return $self->_context->delete(@arguments);
191 }
192  
193 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
194 0 my ($self, @arguments) = @_;
195 0 return $self->_context->fetch(@arguments);
196 }
197  
198 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
199 0 my ($self, @arguments) = @_;
200 0 return $self->_context->update(@arguments);
201 }
202  
203 0 ▶sub user_conversations {
Subroutine user_conversations: not called CC=1 SCAR=6.9
204 0 my ($self, @arguments) = @_;
205 0 return $self->_context->user_conversations(@arguments);
206 }
207  
208 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
209 0 my ($self) = @_;
210 return Twilio::Rest::Conversations::V1::Service::UserContext->new(
211 $self->{version},
212 $self->{solution}{chat_service_sid},
213 $self->{solution}{sid}
214 0 );
215 }
216  
217 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
218 4 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
219 4 ▶sub chat_service_sid { return $_[0]{properties}{chat_service_sid} }
Subroutine chat_service_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 friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
223 4 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
224 4 ▶sub is_notifiable { return $_[0]{properties}{is_notifiable} }
Subroutine is_notifiable: called CC=1 SCAR=0.0
225 4 ▶sub is_online { return $_[0]{properties}{is_online} }
Subroutine is_online: called CC=1 SCAR=0.0
226 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
227 4 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
228 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
229 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
230  
231 2 1;
232  
233 __END__
« Twilio/Rest/Verify/V2/Service/RateLimit.pm ↑ Summary Twilio/Rest/Conversations/V1/User.pm »