Twilio/Rest/Chat/V1/Service/Channel/Invite.pm

filter: Statementstmt 85.5% 77 / 90 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.7% 31 / 37 Podpod n/a totaltotal 81.1% 112 / 138 CC 4 SCAR 2.6
CC
4
Cov
84%
create
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Api/V2010/Account/ShortCode.pm ↑ Summary Twilio/Rest/Chat/V2/Service/Channel/Invite.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Chat::V1::Service::Channel::Invite;
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::Chat::V1::Service::Channel::InviteList;
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 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 4 my ($class, $version, $service_sid, $channel_sid) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { service_sid => $service_sid, channel_sid => $channel_sid };
19 4 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/Channels/', Twilio::Serialize::path_segment($channel_sid), '/Invites';
21 4 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 RoleSid => $options->{role_sid},
31 1 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Chat::V1::Service::Channel::InviteInstance->new(
36 $self->{version}, $response->get_content,
37 $self->{solution}{service_sid},
38 $self->{solution}{channel_sid}
39 1 );
40 }
41  
42 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
43 0 my ($self, @arguments) = @_;
44 0 return $self->read_records(@arguments);
45 }
46  
47 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->stream_records(@arguments);
50 }
51  
52 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
53 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
54 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
55  
56 my $params = {
57 Identity => $options->{identity},
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::Chat::V1::Service::Channel::InvitePage->new($self->{version}, $response,
76 1 $self->{solution});
77 }
78  
79 2 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
80 2 my ($self, $sid) = @_;
81 return Twilio::Rest::Chat::V1::Service::Channel::InviteContext->new(
82 $self->{version},
83 $self->{solution}{service_sid},
84 2 $self->{solution}{channel_sid}, $sid
85 );
86 }
87  
88 package Twilio::Rest::Chat::V1::Service::Channel::InvitePage;
89  
90 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 1 ▶sub records_key { return 'invites' }
Subroutine records_key: called CC=1 SCAR=0.0
93  
94 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
95 1 my ($self, $payload) = @_;
96 return Twilio::Rest::Chat::V1::Service::Channel::InviteInstance->new(
97 $self->{version}, $payload,
98 $self->{solution}{service_sid},
99 $self->{solution}{channel_sid}
100 1 );
101 }
102  
103 package Twilio::Rest::Chat::V1::Service::Channel::InviteContext;
104  
105 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
108  
109 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
110 2 my ($class, $version, $service_sid, $channel_sid, $sid) = @_;
111 2 my $self = $class->SUPER::new($version);
112 2 $self->{solution} = { service_sid => $service_sid, channel_sid => $channel_sid, sid => $sid };
113 2 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
114 '/Channels/', Twilio::Serialize::path_segment($channel_sid), '/Invites/',
115 Twilio::Serialize::path_segment($sid);
116 2 return $self;
117 }
118  
119 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
120 1 my ($self) = @_;
121 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
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 _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
133 1 my ($self, $response) = @_;
134 return Twilio::Rest::Chat::V1::Service::Channel::InviteInstance->new(
135 $self->{version}, $response->get_content,
136 $self->{solution}{service_sid},
137 $self->{solution}{channel_sid},
138 $self->{solution}{sid}
139 1 );
140 }
141  
142 package Twilio::Rest::Chat::V1::Service::Channel::InviteInstance;
143  
144 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
149 3 my ($class, $version, $payload, $service_sid, $channel_sid, $sid) = @_;
150 3 my $self = $class->SUPER::new($version, $payload);
151 $self->{solution} = {
152 service_sid => $service_sid,
153 channel_sid => $channel_sid,
154 sid => $sid // $self->{properties}{sid}
155 3 ▶ };
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
156 3 return $self;
157 }
158  
159 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
160 0 my ($self, @arguments) = @_;
161 0 return $self->_context->delete(@arguments);
162 }
163  
164 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
165 0 my ($self, @arguments) = @_;
166 0 return $self->_context->fetch(@arguments);
167 }
168  
169 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
170 0 my ($self) = @_;
171 return Twilio::Rest::Chat::V1::Service::Channel::InviteContext->new(
172 $self->{version},
173 $self->{solution}{service_sid},
174 $self->{solution}{channel_sid},
175 $self->{solution}{sid}
176 0 );
177 }
178  
179 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
180 3 ▶sub channel_sid { return $_[0]{properties}{channel_sid} }
Subroutine channel_sid: called CC=1 SCAR=0.0
181 3 ▶sub created_by { return $_[0]{properties}{created_by} }
Subroutine created_by: called CC=1 SCAR=0.0
182 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
183 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
184 3 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
185 3 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
186 3 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
187 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
188 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
189  
190 2 1;
191  
192 __END__
« Twilio/Rest/Api/V2010/Account/ShortCode.pm ↑ Summary Twilio/Rest/Chat/V2/Service/Channel/Invite.pm »