| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Serverless::V1::Service; | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 3 | ▶ | use 5.016; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 3 | our $VERSION = '2.001'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | package Twilio::Rest::Serverless::V1::ServiceList; | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 3 | ▶ | use parent 'Twilio::ListResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 3 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 40 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 40 | my ($class, $version) = @_; | |||||||||||||||||||
| 17 | 40 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 40 | $self->{solution} = {}; | |||||||||||||||||||
| 19 | 40 | $self->{uri} = '/Services'; | |||||||||||||||||||
| 20 | 40 | return $self; | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | sub create { | ||||||||||||||||||
|
Subroutine
create: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 24 | 1 | my ($self, $unique_name, $friendly_name, $options) = @_; | |||||||||||||||||||
| 25 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | my $data = { | ||||||||||||||||||||
| 28 | UniqueName => $unique_name, | ||||||||||||||||||||
| 29 | FriendlyName => $friendly_name, | ||||||||||||||||||||
| 30 | IncludeCredentials => Twilio::Serialize::boolean_to_string($options->{include_credentials}), | ||||||||||||||||||||
| 31 | 1 | UiEditable => Twilio::Serialize::boolean_to_string($options->{ui_editable}), | |||||||||||||||||||
| 32 | }; | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | my $response = | ||||||||||||||||||||
| 35 | 1 | $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data }); | |||||||||||||||||||
| 36 | return Twilio::Rest::Serverless::V1::ServiceInstance->new($self->{version}, | ||||||||||||||||||||
| 37 | 1 | $response->get_content); | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 41 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 42 | 0 | return $self->read_records(@arguments); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 0 | ▶ | sub stream { | ||||||||||||||||||
|
Subroutine
stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 46 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 47 | 0 | return $self->stream_records(@arguments); | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 1 | ▶ | sub page { | ||||||||||||||||||
|
Subroutine
page: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 51 | 1 | my ($self, $options, $page_size, $page_token, $page_number) = @_; | |||||||||||||||||||
| 52 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 1 | my $params = { | |||||||||||||||||||
| 55 | PageToken => $page_token, | ||||||||||||||||||||
| 56 | Page => $page_number, | ||||||||||||||||||||
| 57 | PageSize => $page_size, | ||||||||||||||||||||
| 58 | }; | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 61 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 65 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 66 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 67 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 71 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 72 | return Twilio::Rest::Serverless::V1::ServicePage->new($self->{version}, $response, | ||||||||||||||||||||
| 73 | 1 | $self->{solution}); | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | 38 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 77 | 38 | my ($self, $sid) = @_; | |||||||||||||||||||
| 78 | 38 | return Twilio::Rest::Serverless::V1::ServiceContext->new($self->{version}, $sid); | |||||||||||||||||||
| 79 | } | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | package Twilio::Rest::Serverless::V1::ServicePage; | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 3 | ▶ | use parent 'Twilio::Page'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 1 | ▶ | sub records_key { return 'services' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 88 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 89 | 1 | return Twilio::Rest::Serverless::V1::ServiceInstance->new($self->{version}, $payload); | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | package Twilio::Rest::Serverless::V1::ServiceContext; | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | 3 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 3 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 38 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 99 | 38 | my ($class, $version, $sid) = @_; | |||||||||||||||||||
| 100 | 38 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 101 | 38 | $self->{solution} = { sid => $sid }; | |||||||||||||||||||
| 102 | 38 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($sid); | |||||||||||||||||||
| 103 | 38 | return $self; | |||||||||||||||||||
| 104 | } | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | 1 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 107 | 1 | my ($self) = @_; | |||||||||||||||||||
| 108 | 1 | $self->{version}->handle_request('DELETE', $self->{uri}, 'delete'); | |||||||||||||||||||
| 109 | 1 | return 1; | |||||||||||||||||||
| 110 | } | ||||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | 2 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 113 | 2 | my ($self) = @_; | |||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 2 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch'); | |||||||||||||||||||
| 116 | 2 | return $self->_build_instance($response); | |||||||||||||||||||
| 117 | } | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | 1 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 120 | 1 | my ($self, $options) = @_; | |||||||||||||||||||
| 121 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | my $data = { | ||||||||||||||||||||
| 124 | FriendlyName => $options->{friendly_name}, | ||||||||||||||||||||
| 125 | IncludeCredentials => Twilio::Serialize::boolean_to_string($options->{include_credentials}), | ||||||||||||||||||||
| 126 | 1 | UiEditable => Twilio::Serialize::boolean_to_string($options->{ui_editable}), | |||||||||||||||||||
| 127 | }; | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | my $response = | ||||||||||||||||||||
| 130 | 1 | $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data }); | |||||||||||||||||||
| 131 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 132 | } | ||||||||||||||||||||
| 133 | |||||||||||||||||||||
| 134 | 3 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 135 | 3 | my ($self, $response) = @_; | |||||||||||||||||||
| 136 | return Twilio::Rest::Serverless::V1::ServiceInstance->new($self->{version}, | ||||||||||||||||||||
| 137 | 3 | $response->get_content, $self->{solution}{sid}); | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | 7 | ▶ | sub assets { | ||||||||||||||||||
|
Subroutine
assets: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 141 | 7 | my ($self, $sid) = @_; | |||||||||||||||||||
| 142 | 7 | require Twilio::Rest::Serverless::V1::Service::Asset; | |||||||||||||||||||
| 143 | my $list = | ||||||||||||||||||||
| 144 | 7 | Twilio::Rest::Serverless::V1::Service::AssetList->new($self->{version}, $self->{solution}{sid}); | |||||||||||||||||||
| 145 | 7 | ▶ | return defined $sid ? $list->get_context($sid) : $list; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 146 | } | ||||||||||||||||||||
| 147 | |||||||||||||||||||||
| 148 | 5 | ▶ | sub builds { | ||||||||||||||||||
|
Subroutine
builds: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 149 | 5 | my ($self, $sid) = @_; | |||||||||||||||||||
| 150 | 5 | require Twilio::Rest::Serverless::V1::Service::Build; | |||||||||||||||||||
| 151 | my $list = | ||||||||||||||||||||
| 152 | 5 | Twilio::Rest::Serverless::V1::Service::BuildList->new($self->{version}, $self->{solution}{sid}); | |||||||||||||||||||
| 153 | 5 | ▶ | return defined $sid ? $list->get_context($sid) : $list; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 154 | } | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | 14 | ▶ | sub environments { | ||||||||||||||||||
|
Subroutine
environments: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 157 | 14 | my ($self, $sid) = @_; | |||||||||||||||||||
| 158 | 14 | require Twilio::Rest::Serverless::V1::Service::Environment; | |||||||||||||||||||
| 159 | my $list = Twilio::Rest::Serverless::V1::Service::EnvironmentList->new($self->{version}, | ||||||||||||||||||||
| 160 | 14 | $self->{solution}{sid}); | |||||||||||||||||||
| 161 | 14 | ▶ | return defined $sid ? $list->get_context($sid) : $list; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 162 | } | ||||||||||||||||||||
| 163 | |||||||||||||||||||||
| 164 | 8 | ▶ | sub functions { | ||||||||||||||||||
|
Subroutine
functions: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 165 | 8 | my ($self, $sid) = @_; | |||||||||||||||||||
| 166 | 8 | require Twilio::Rest::Serverless::V1::Service::Function; | |||||||||||||||||||
| 167 | my $list = Twilio::Rest::Serverless::V1::Service::FunctionList->new($self->{version}, | ||||||||||||||||||||
| 168 | 8 | $self->{solution}{sid}); | |||||||||||||||||||
| 169 | 8 | ▶ | return defined $sid ? $list->get_context($sid) : $list; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 170 | } | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | package Twilio::Rest::Serverless::V1::ServiceInstance; | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | 3 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | 3 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | 5 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 179 | 5 | my ($class, $version, $payload, $sid) = @_; | |||||||||||||||||||
| 180 | 5 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 181 | 5 | ▶ | $self->{solution} = { 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"}
| |||||||||||||||||||||
| 182 | 5 | 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 update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 196 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 197 | 0 | return $self->_context->update(@arguments); | |||||||||||||||||||
| 198 | } | ||||||||||||||||||||
| 199 | |||||||||||||||||||||
| 200 | 0 | ▶ | sub assets { | ||||||||||||||||||
|
Subroutine
assets: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 201 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 202 | 0 | return $self->_context->assets(@arguments); | |||||||||||||||||||
| 203 | } | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | 0 | ▶ | sub builds { | ||||||||||||||||||
|
Subroutine
builds: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 206 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 207 | 0 | return $self->_context->builds(@arguments); | |||||||||||||||||||
| 208 | } | ||||||||||||||||||||
| 209 | |||||||||||||||||||||
| 210 | 0 | ▶ | sub environments { | ||||||||||||||||||
|
Subroutine
environments: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 211 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 212 | 0 | return $self->_context->environments(@arguments); | |||||||||||||||||||
| 213 | } | ||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | 0 | ▶ | sub functions { | ||||||||||||||||||
|
Subroutine
functions: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 216 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 217 | 0 | return $self->_context->functions(@arguments); | |||||||||||||||||||
| 218 | } | ||||||||||||||||||||
| 219 | |||||||||||||||||||||
| 220 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 221 | 0 | my ($self) = @_; | |||||||||||||||||||
| 222 | return Twilio::Rest::Serverless::V1::ServiceContext->new($self->{version}, | ||||||||||||||||||||
| 223 | 0 | $self->{solution}{sid}); | |||||||||||||||||||
| 224 | } | ||||||||||||||||||||
| 225 | |||||||||||||||||||||
| 226 | 4 | ▶ | sub account_sid { return $_[0]{properties}{account_sid} } | ||||||||||||||||||
|
Subroutine
account_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 227 | 6 | ▶ | sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) } | ||||||||||||||||||
|
Subroutine
date_created: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 228 | 4 | ▶ | sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) } | ||||||||||||||||||
|
Subroutine
date_updated: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 229 | 4 | ▶ | sub domain_base { return $_[0]{properties}{domain_base} } | ||||||||||||||||||
|
Subroutine
domain_base: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 230 | 4 | ▶ | sub friendly_name { return $_[0]{properties}{friendly_name} } | ||||||||||||||||||
|
Subroutine
friendly_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 231 | 4 | ▶ | sub include_credentials { return $_[0]{properties}{include_credentials} } | ||||||||||||||||||
|
Subroutine
include_credentials: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 232 | 4 | ▶ | sub links { return $_[0]{properties}{links} } | ||||||||||||||||||
|
Subroutine
links: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 233 | 4 | ▶ | sub sid { return $_[0]{properties}{sid} } | ||||||||||||||||||
|
Subroutine
sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 234 | 4 | ▶ | sub ui_editable { return $_[0]{properties}{ui_editable} } | ||||||||||||||||||
|
Subroutine
ui_editable: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 235 | 4 | ▶ | sub unique_name { return $_[0]{properties}{unique_name} } | ||||||||||||||||||
|
Subroutine
unique_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 236 | 4 | ▶ | sub url { return $_[0]{properties}{url} } | ||||||||||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 237 | |||||||||||||||||||||
| 238 | 3 | 1; | |||||||||||||||||||
| 239 | |||||||||||||||||||||
| 240 | __END__ | ||||||||||||||||||||