Twilio/Rest/PreviewIam/Versionless/Organization/RoleAssignment.pm

filter: Statementstmt 85.9% 67 / 78 Branchbran n/a Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 25 / 30 Podpod n/a totaltotal 81.0% 94 / 116 CC 3 SCAR 2.5
CC
3
Cov
83%
new
2.1
page
2.0
read
2.0
CRAP 1.3
« Twilio/Rest/Webhooks/V1/AuthProfile.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Sip/Domain/CredentialListMapping.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignment;
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::PreviewIam::Versionless::Organization::RoleAssignmentList;
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 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 3 my ($class, $version, $organization_sid) = @_;
17 3 my $self = $class->SUPER::new($version);
18 3 $self->{solution} = { organization_sid => $organization_sid };
19 3 $self->{uri} = join q{}, '/Organizations/', Twilio::Serialize::path_segment($organization_sid),
20 '/RoleAssignments';
21 3 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
25 1 my ($self, $body) = @_;
26  
27 1 my $data = Twilio::Serialize::json_body($body, {});
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 1 'create',
33 {
34 data => $data,
35 headers => { 'Content-Type' => 'application/json', }
36 }
37 );
38 return Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentInstance->new(
39 1 $self->{version}, $response->get_content, $self->{solution}{organization_sid});
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 ResourceId => $options->{resource_id},
59 ResourceType => $options->{resource_type},
60 Scope => $options->{scope},
61 1 PageToken => $page_token,
62 Page => $page_number,
63 PageSize => $page_size,
64 };
65  
66 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
67 1 return $self->_build_page($response);
68 }
69  
70 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
71 0 my ($self, $target_url) = @_;
72 0 my $client = $self->{version}->get_domain->get_client;
73 0 return $self->_build_page($client->request('GET', $target_url));
74 }
75  
76 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
77 1 my ($self, $response) = @_;
78 return Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentPage->new(
79 1 $self->{version}, $response, $self->{solution});
80 }
81  
82 1 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
83 1 my ($self, $role_assignment_sid) = @_;
84 return Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentContext->new(
85 $self->{version}, $self->{solution}{organization_sid},
86 1 $role_assignment_sid);
87 }
88  
89 package Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentPage;
90  
91 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
92  
93 1 ▶sub records_key { return 'content' }
Subroutine records_key: called CC=1 SCAR=0.0
94  
95 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
96 1 my ($self, $payload) = @_;
97 return Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentInstance->new(
98 1 $self->{version}, $payload, $self->{solution}{organization_sid});
99 }
100  
101 package Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentContext;
102  
103 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
108 1 my ($class, $version, $organization_sid, $role_assignment_sid) = @_;
109 1 my $self = $class->SUPER::new($version);
110 $self->{solution} =
111 1 { organization_sid => $organization_sid, role_assignment_sid => $role_assignment_sid };
112 1 $self->{uri} = join q{}, '/Organizations/', Twilio::Serialize::path_segment($organization_sid),
113 '/RoleAssignments/', Twilio::Serialize::path_segment($role_assignment_sid);
114 1 return $self;
115 }
116  
117 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
118 1 my ($self) = @_;
119 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
120 1 return 1;
121 }
122  
123 package Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentInstance;
124  
125 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
126  
127 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
128  
129 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.4
130 2 my ($class, $version, $payload, $organization_sid, $role_assignment_sid) = @_;
131 2 my $self = $class->SUPER::new($version, $payload);
132 $self->{solution} = {
133 organization_sid => $organization_sid,
134 role_assignment_sid => $role_assignment_sid // $self->{properties}{sid}
135 2 ▶ };
Condition33%1/3
$role_assignment_sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
020
MC/DC0%0/2
$role_assignment_sid // $self->{"properties"}{"sid"}
$role_assignment_sid $self->{"properties"}{"sid"}
Truth table33%1/3
A // B
A= $role_assignment_sidB= $self->{"properties"}{"sid"}
ABresult
1X1
011
000
136 2 return $self;
137 }
138  
139 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
140 0 my ($self, @arguments) = @_;
141 0 return $self->_context->delete(@arguments);
142 }
143  
144 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
145 0 my ($self) = @_;
146 return Twilio::Rest::PreviewIam::Versionless::Organization::RoleAssignmentContext->new(
147 $self->{version},
148 $self->{solution}{organization_sid},
149 $self->{solution}{role_assignment_sid}
150 0 );
151 }
152  
153 2 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
154 2 ▶sub resource_id { return $_[0]{properties}{resource_id} }
Subroutine resource_id: called CC=1 SCAR=0.0
155 2 ▶sub resource_type { return $_[0]{properties}{resource_type} }
Subroutine resource_type: called CC=1 SCAR=0.0
156 2 ▶sub role_sid { return $_[0]{properties}{role_sid} }
Subroutine role_sid: called CC=1 SCAR=0.0
157 2 ▶sub scope { return $_[0]{properties}{scope} }
Subroutine scope: called CC=1 SCAR=0.0
158 2 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
159  
160 2 1;
161  
162 __END__
« Twilio/Rest/Webhooks/V1/AuthProfile.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Sip/Domain/CredentialListMapping.pm »