| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Chat::V1::Service::Role; | ||||||||||||||||||||
| 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::RoleList; | ||||||||||||||||||||
| 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 | 5 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 5 | my ($class, $version, $service_sid) = @_; | |||||||||||||||||||
| 17 | 5 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 5 | $self->{solution} = { service_sid => $service_sid }; | |||||||||||||||||||
| 19 | 5 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Roles'; | |||||||||||||||||||
| 20 | 5 | return $self; | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | sub create { | ||||||||||||||||||
|
Subroutine
create: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 1 | my ($self, $friendly_name, $type, $permission) = @_; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | my $data = { | |||||||||||||||||||
| 27 | FriendlyName => $friendly_name, | ||||||||||||||||||||
| 28 | Type => $type, | ||||||||||||||||||||
| 29 | Permission => $permission, | ||||||||||||||||||||
| 30 | }; | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | my $response = | ||||||||||||||||||||
| 33 | 1 | $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data }); | |||||||||||||||||||
| 34 | return Twilio::Rest::Chat::V1::Service::RoleInstance->new($self->{version}, | ||||||||||||||||||||
| 35 | 1 | $response->get_content, $self->{solution}{service_sid}); | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 39 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 40 | 0 | return $self->read_records(@arguments); | |||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 0 | ▶ | sub stream { | ||||||||||||||||||
|
Subroutine
stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 44 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 45 | 0 | return $self->stream_records(@arguments); | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 1 | ▶ | sub page { | ||||||||||||||||||
|
Subroutine
page: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 49 | 1 | my ($self, $options, $page_size, $page_token, $page_number) = @_; | |||||||||||||||||||
| 50 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 1 | my $params = { | |||||||||||||||||||
| 53 | PageToken => $page_token, | ||||||||||||||||||||
| 54 | Page => $page_number, | ||||||||||||||||||||
| 55 | PageSize => $page_size, | ||||||||||||||||||||
| 56 | }; | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 59 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 63 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 64 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 65 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 69 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 70 | return Twilio::Rest::Chat::V1::Service::RolePage->new($self->{version}, $response, | ||||||||||||||||||||
| 71 | 1 | $self->{solution}); | |||||||||||||||||||
| 72 | } | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 3 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 75 | 3 | my ($self, $sid) = @_; | |||||||||||||||||||
| 76 | return Twilio::Rest::Chat::V1::Service::RoleContext->new($self->{version}, | ||||||||||||||||||||
| 77 | 3 | $self->{solution}{service_sid}, $sid); | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | package Twilio::Rest::Chat::V1::Service::RolePage; | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 2 | ▶ | use parent 'Twilio::Page'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 1 | ▶ | sub records_key { return 'roles' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 87 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 88 | return Twilio::Rest::Chat::V1::Service::RoleInstance->new($self->{version}, $payload, | ||||||||||||||||||||
| 89 | 1 | $self->{solution}{service_sid}); | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | package Twilio::Rest::Chat::V1::Service::RoleContext; | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | 2 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 2 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 99 | 3 | my ($class, $version, $service_sid, $sid) = @_; | |||||||||||||||||||
| 100 | 3 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 101 | 3 | $self->{solution} = { service_sid => $service_sid, sid => $sid }; | |||||||||||||||||||
| 102 | 3 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Roles/', | |||||||||||||||||||
| 103 | Twilio::Serialize::path_segment($sid); | ||||||||||||||||||||
| 104 | 3 | return $self; | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | 1 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 108 | 1 | my ($self) = @_; | |||||||||||||||||||
| 109 | 1 | $self->{version}->handle_request('DELETE', $self->{uri}, 'delete'); | |||||||||||||||||||
| 110 | 1 | return 1; | |||||||||||||||||||
| 111 | } | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 1 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 114 | 1 | my ($self) = @_; | |||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | 1 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch'); | |||||||||||||||||||
| 117 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 118 | } | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | 1 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 121 | 1 | my ($self, $permission) = @_; | |||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | 1 | my $data = { Permission => $permission, }; | |||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | my $response = | ||||||||||||||||||||
| 126 | 1 | $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data }); | |||||||||||||||||||
| 127 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 128 | } | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | 2 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 131 | 2 | my ($self, $response) = @_; | |||||||||||||||||||
| 132 | return Twilio::Rest::Chat::V1::Service::RoleInstance->new( | ||||||||||||||||||||
| 133 | $self->{version}, $response->get_content, | ||||||||||||||||||||
| 134 | $self->{solution}{service_sid}, $self->{solution}{sid} | ||||||||||||||||||||
| 135 | 2 | ); | |||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | package Twilio::Rest::Chat::V1::Service::RoleInstance; | ||||||||||||||||||||
| 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 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 145 | 4 | my ($class, $version, $payload, $service_sid, $sid) = @_; | |||||||||||||||||||
| 146 | 4 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 147 | 4 | ▶ | $self->{solution} = { service_sid => $service_sid, sid => $sid // $self->{properties}{sid} }; | ||||||||||||||||||
|
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
MC/DC0%0/2
$sid // $self->{"properties"}{"sid"}
$sid
$self->{"properties"}{"sid"}
Truth table66%2/3
A // B
A= $sidB= $self->{"properties"}{"sid"}
| |||||||||||||||||||||
| 148 | 4 | return $self; | |||||||||||||||||||
| 149 | } | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 0 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 152 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 153 | 0 | return $self->_context->delete(@arguments); | |||||||||||||||||||
| 154 | } | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 157 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 158 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 159 | } | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | 0 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 162 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 163 | 0 | return $self->_context->update(@arguments); | |||||||||||||||||||
| 164 | } | ||||||||||||||||||||
| 165 | |||||||||||||||||||||
| 166 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 167 | 0 | my ($self) = @_; | |||||||||||||||||||
| 168 | return Twilio::Rest::Chat::V1::Service::RoleContext->new( | ||||||||||||||||||||
| 169 | $self->{version}, | ||||||||||||||||||||
| 170 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 171 | $self->{solution}{sid} | ||||||||||||||||||||
| 172 | 0 | ); | |||||||||||||||||||
| 173 | } | ||||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | 4 | ▶ | sub account_sid { return $_[0]{properties}{account_sid} } | ||||||||||||||||||
|
Subroutine
account_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 176 | 4 | ▶ | sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) } | ||||||||||||||||||
|
Subroutine
date_created: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 177 | 4 | ▶ | sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) } | ||||||||||||||||||
|
Subroutine
date_updated: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 178 | 4 | ▶ | sub friendly_name { return $_[0]{properties}{friendly_name} } | ||||||||||||||||||
|
Subroutine
friendly_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 179 | 4 | ▶ | sub permissions { return $_[0]{properties}{permissions} } | ||||||||||||||||||
|
Subroutine
permissions: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 180 | 4 | ▶ | sub service_sid { return $_[0]{properties}{service_sid} } | ||||||||||||||||||
|
Subroutine
service_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 181 | 4 | ▶ | sub sid { return $_[0]{properties}{sid} } | ||||||||||||||||||
|
Subroutine
sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 182 | 4 | ▶ | sub type { return $_[0]{properties}{type} } | ||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 183 | 4 | ▶ | sub url { return $_[0]{properties}{url} } | ||||||||||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | 2 | 1; | |||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | __END__ | ||||||||||||||||||||