Twilio/Rest/Sync/V1/Service/Document/DocumentPermission.pm

filter: Statementstmt 83.1% 74 / 89 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 80.5% 29 / 36 Podpod n/a totaltotal 79.7% 106 / 133 CC 3 SCAR 2.6
CC
3
Cov
82%
page
2.0
new
2.0
read
2.0
CRAP 1.3
« Twilio/Rest/Insights/V1/Call.pm ↑ Summary Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermission.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Sync::V1::Service::Document::DocumentPermission;
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::Sync::V1::Service::Document::DocumentPermissionList;
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, $document_sid) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { service_sid => $service_sid, document_sid => $document_sid };
19 4 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/Documents/', Twilio::Serialize::path_segment($document_sid), '/Permissions';
21 4 return $self;
22 }
23  
24 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
25 0 my ($self, @arguments) = @_;
26 0 return $self->read_records(@arguments);
27 }
28  
29 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
30 0 my ($self, @arguments) = @_;
31 0 return $self->stream_records(@arguments);
32 }
33  
34 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
35 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
36 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
37  
38 1 my $params = {
39 PageToken => $page_token,
40 Page => $page_number,
41 PageSize => $page_size,
42 };
43  
44 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
45 1 return $self->_build_page($response);
46 }
47  
48 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
49 0 my ($self, $target_url) = @_;
50 0 my $client = $self->{version}->get_domain->get_client;
51 0 return $self->_build_page($client->request('GET', $target_url));
52 }
53  
54 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
55 1 my ($self, $response) = @_;
56 return Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionPage->new($self->{version},
57 1 $response, $self->{solution});
58 }
59  
60 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
61 3 my ($self, $identity) = @_;
62 return Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionContext->new(
63 $self->{version},
64 $self->{solution}{service_sid},
65 3 $self->{solution}{document_sid}, $identity
66 );
67 }
68  
69 package Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionPage;
70  
71 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 1 ▶sub records_key { return 'permissions' }
Subroutine records_key: called CC=1 SCAR=0.0
74  
75 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
76 1 my ($self, $payload) = @_;
77 return Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionInstance->new(
78 $self->{version}, $payload,
79 $self->{solution}{service_sid},
80 $self->{solution}{document_sid}
81 1 );
82 }
83  
84 package Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionContext;
85  
86 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
91 3 my ($class, $version, $service_sid, $document_sid, $identity) = @_;
92 3 my $self = $class->SUPER::new($version);
93 $self->{solution} =
94 3 { service_sid => $service_sid, document_sid => $document_sid, identity => $identity };
95 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
96 '/Documents/', Twilio::Serialize::path_segment($document_sid), '/Permissions/',
97 Twilio::Serialize::path_segment($identity);
98 3 return $self;
99 }
100  
101 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
102 1 my ($self) = @_;
103 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
104 1 return 1;
105 }
106  
107 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
108 1 my ($self) = @_;
109  
110 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
111 1 return $self->_build_instance($response);
112 }
113  
114 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
115 1 my ($self, $read, $write, $manage) = @_;
116  
117 1 my $data = {
118 Read => Twilio::Serialize::boolean_to_string($read),
119 Write => Twilio::Serialize::boolean_to_string($write),
120 Manage => Twilio::Serialize::boolean_to_string($manage),
121 };
122  
123 my $response =
124 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
125 1 return $self->_build_instance($response);
126 }
127  
128 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
129 2 my ($self, $response) = @_;
130 return Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionInstance->new(
131 $self->{version}, $response->get_content,
132 $self->{solution}{service_sid},
133 $self->{solution}{document_sid},
134 $self->{solution}{identity}
135 2 );
136 }
137  
138 package Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionInstance;
139  
140 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
141  
142 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
143  
144 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
145 3 my ($class, $version, $payload, $service_sid, $document_sid, $identity) = @_;
146 3 my $self = $class->SUPER::new($version, $payload);
147 $self->{solution} = {
148 service_sid => $service_sid,
149 document_sid => $document_sid,
150 identity => $identity // $self->{properties}{identity}
151 3 ▶ };
Condition66%2/3
$identity // $self->{"properties"}{"identity"}
l!l&&r!l&&!r
210
MC/DC0%0/2
$identity // $self->{"properties"}{"identity"}
$identity $self->{"properties"}{"identity"}
Truth table66%2/3
A // B
A= $identityB= $self->{"properties"}{"identity"}
ABresult
1X1
011
000
152 3 return $self;
153 }
154  
155 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
156 0 my ($self, @arguments) = @_;
157 0 return $self->_context->delete(@arguments);
158 }
159  
160 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
161 0 my ($self, @arguments) = @_;
162 0 return $self->_context->fetch(@arguments);
163 }
164  
165 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->update(@arguments);
168 }
169  
170 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
171 0 my ($self) = @_;
172 return Twilio::Rest::Sync::V1::Service::Document::DocumentPermissionContext->new(
173 $self->{version}, $self->{solution}{service_sid},
174 $self->{solution}{document_sid}, $self->{solution}{identity}
175 0 );
176 }
177  
178 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
179 3 ▶sub document_sid { return $_[0]{properties}{document_sid} }
Subroutine document_sid: called CC=1 SCAR=0.0
180 3 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
181 3 ▶sub manage { return $_[0]{properties}{manage} }
Subroutine manage: called CC=1 SCAR=0.0
182 3 ▶sub read { return $_[0]{properties}{read} }
Subroutine read: called CC=1 SCAR=0.0
183 3 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
184 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
185 3 ▶sub write { return $_[0]{properties}{write} }
Subroutine write: called CC=1 SCAR=0.0
186  
187 2 1;
188  
189 __END__
« Twilio/Rest/Insights/V1/Call.pm ↑ Summary Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermission.pm »