Twilio/Rest/Conversations/V1/Service.pm

filter: Statementstmt 78.4% 98 / 125 Branchbran 100% 8 / 8 Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 72.9% 35 / 48 Podpod n/a totaltotal 76.1% 144 / 189 CC 7 SCAR 3.8
CC
7
Cov
79%
page
2.0
new
2.0
read
2.0
CRAP 1.5
« Twilio/Rest/Verify/V2/Service.pm ↑ Summary Twilio/Rest/FlexApi/V1/InsightsQuestionnaires.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::Service;
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::ServiceList;
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 52 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 52 my ($class, $version) = @_;
17 52 my $self = $class->SUPER::new($version);
18 52 $self->{solution} = {};
19 52 $self->{uri} = '/Services';
20 52 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 1 my ($self, $friendly_name) = @_;
25  
26 1 my $data = { FriendlyName => $friendly_name, };
27  
28 my $response =
29 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
30 return Twilio::Rest::Conversations::V1::ServiceInstance->new($self->{version},
31 1 $response->get_content);
32 }
33  
34 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
35 0 my ($self, @arguments) = @_;
36 0 return $self->read_records(@arguments);
37 }
38  
39 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->stream_records(@arguments);
42 }
43  
44 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
45 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
46 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
47  
48 1 my $params = {
49 PageToken => $page_token,
50 Page => $page_number,
51 PageSize => $page_size,
52 };
53  
54 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
55 1 return $self->_build_page($response);
56 }
57  
58 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
59 0 my ($self, $target_url) = @_;
60 0 my $client = $self->{version}->get_domain->get_client;
61 0 return $self->_build_page($client->request('GET', $target_url));
62 }
63  
64 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
65 1 my ($self, $response) = @_;
66 return Twilio::Rest::Conversations::V1::ServicePage->new($self->{version}, $response,
67 1 $self->{solution});
68 }
69  
70 50 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
71 50 my ($self, $sid) = @_;
72 50 return Twilio::Rest::Conversations::V1::ServiceContext->new($self->{version}, $sid);
73 }
74  
75 package Twilio::Rest::Conversations::V1::ServicePage;
76  
77 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
78  
79 1 ▶sub records_key { return 'services' }
Subroutine records_key: called CC=1 SCAR=0.0
80  
81 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
82 1 my ($self, $payload) = @_;
83 1 return Twilio::Rest::Conversations::V1::ServiceInstance->new($self->{version}, $payload);
84 }
85  
86 package Twilio::Rest::Conversations::V1::ServiceContext;
87  
88 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 50 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
93 50 my ($class, $version, $sid) = @_;
94 50 my $self = $class->SUPER::new($version);
95 50 $self->{solution} = { sid => $sid };
96 50 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid);
97 50 return $self;
98 }
99  
100 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
101 1 my ($self) = @_;
102 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
103 1 return 1;
104 }
105  
106 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
107 1 my ($self) = @_;
108  
109 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
110 1 return $self->_build_instance($response);
111 }
112  
113 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
114 1 my ($self, $response) = @_;
115 return Twilio::Rest::Conversations::V1::ServiceInstance->new($self->{version},
116 1 $response->get_content, $self->{solution}{sid});
117 }
118  
119 3 ▶sub bindings {
Subroutine bindings: called CC=2 SCAR=6.9
120 3 my ($self, $sid) = @_;
121 3 require Twilio::Rest::Conversations::V1::Service::Binding;
122 my $list = Twilio::Rest::Conversations::V1::Service::BindingList->new($self->{version},
123 3 $self->{solution}{sid});
124 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
125 }
126  
127 6 ▶sub configuration {
Subroutine configuration: called CC=1 SCAR=0.0
128 6 my ($self) = @_;
129 6 require Twilio::Rest::Conversations::V1::Service::Configuration;
130 return Twilio::Rest::Conversations::V1::Service::ConfigurationContext->new($self->{version},
131 6 $self->{solution}{sid});
132 }
133  
134 22 ▶sub conversations {
Subroutine conversations: called CC=2 SCAR=6.9
135 22 my ($self, $sid) = @_;
136 22 require Twilio::Rest::Conversations::V1::Service::Conversation;
137 my $list = Twilio::Rest::Conversations::V1::Service::ConversationList->new($self->{version},
138 22 $self->{solution}{sid});
139 22 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 20 2 22
140 }
141  
142 2 ▶sub conversation_with_participants {
Subroutine conversation_with_participants: called CC=1 SCAR=0.0
143 2 my ($self) = @_;
144 2 require Twilio::Rest::Conversations::V1::Service::ConversationWithParticipants;
145 return Twilio::Rest::Conversations::V1::Service::ConversationWithParticipantsList->new(
146 2 $self->{version}, $self->{solution}{sid});
147 }
148  
149 1 ▶sub participant_conversations {
Subroutine participant_conversations: called CC=1 SCAR=0.0
150 1 my ($self) = @_;
151 1 require Twilio::Rest::Conversations::V1::Service::ParticipantConversation;
152 return Twilio::Rest::Conversations::V1::Service::ParticipantConversationList->new(
153 1 $self->{version}, $self->{solution}{sid});
154 }
155  
156 5 ▶sub roles {
Subroutine roles: called CC=2 SCAR=6.9
157 5 my ($self, $sid) = @_;
158 5 require Twilio::Rest::Conversations::V1::Service::Role;
159 my $list = Twilio::Rest::Conversations::V1::Service::RoleList->new($self->{version},
160 5 $self->{solution}{sid});
161 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
162 }
163  
164 9 ▶sub users {
Subroutine users: called CC=2 SCAR=6.9
165 9 my ($self, $sid) = @_;
166 9 require Twilio::Rest::Conversations::V1::Service::User;
167 my $list = Twilio::Rest::Conversations::V1::Service::UserList->new($self->{version},
168 9 $self->{solution}{sid});
169 9 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 7 2 9
170 }
171  
172 package Twilio::Rest::Conversations::V1::ServiceInstance;
173  
174 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
175  
176 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
177  
178 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
179 3 my ($class, $version, $payload, $sid) = @_;
180 3 my $self = $class->SUPER::new($version, $payload);
181 3 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
120
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
182 3 return $self;
183 }
184  
185 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
186 0 my ($self, @arguments) = @_;
187 0 return $self->_context->delete(@arguments);
188 }
189  
190 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
191 0 my ($self, @arguments) = @_;
192 0 return $self->_context->fetch(@arguments);
193 }
194  
195 0 ▶sub bindings {
Subroutine bindings: not called CC=1 SCAR=6.9
196 0 my ($self, @arguments) = @_;
197 0 return $self->_context->bindings(@arguments);
198 }
199  
200 0 ▶sub configuration {
Subroutine configuration: not called CC=1 SCAR=6.9
201 0 my ($self, @arguments) = @_;
202 0 return $self->_context->configuration(@arguments);
203 }
204  
205 0 ▶sub conversations {
Subroutine conversations: not called CC=1 SCAR=6.9
206 0 my ($self, @arguments) = @_;
207 0 return $self->_context->conversations(@arguments);
208 }
209  
210 0 ▶sub conversation_with_participants {
Subroutine conversation_with_participants: not called CC=1 SCAR=6.9
211 0 my ($self, @arguments) = @_;
212 0 return $self->_context->conversation_with_participants(@arguments);
213 }
214  
215 0 ▶sub participant_conversations {
Subroutine participant_conversations: not called CC=1 SCAR=6.9
216 0 my ($self, @arguments) = @_;
217 0 return $self->_context->participant_conversations(@arguments);
218 }
219  
220 0 ▶sub roles {
Subroutine roles: not called CC=1 SCAR=6.9
221 0 my ($self, @arguments) = @_;
222 0 return $self->_context->roles(@arguments);
223 }
224  
225 0 ▶sub users {
Subroutine users: not called CC=1 SCAR=6.9
226 0 my ($self, @arguments) = @_;
227 0 return $self->_context->users(@arguments);
228 }
229  
230 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
231 0 my ($self) = @_;
232 return Twilio::Rest::Conversations::V1::ServiceContext->new($self->{version},
233 0 $self->{solution}{sid});
234 }
235  
236 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
237 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
238 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
239 3 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
240 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
241 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
242 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
243  
244 2 1;
245  
246 __END__
« Twilio/Rest/Verify/V2/Service.pm ↑ Summary Twilio/Rest/FlexApi/V1/InsightsQuestionnaires.pm »