| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Memory::V1::Profile; | ||||||||||||||||||||
| 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::Memory::V1::ProfileList; | ||||||||||||||||||||
| 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 | 9 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 9 | my ($class, $version, $store_id) = @_; | |||||||||||||||||||
| 17 | 9 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 9 | $self->{solution} = { store_id => $store_id }; | |||||||||||||||||||
| 19 | 9 | $self->{uri} = join q{}, '/Stores/', Twilio::Serialize::path_segment($store_id), '/Profiles'; | |||||||||||||||||||
| 20 | 9 | return $self; | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | sub create { | ||||||||||||||||||
|
Subroutine
create: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 1 | my ($self, $body) = @_; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | my $data = Twilio::Serialize::json_body($body, {}); | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | my $response = $self->{version}->handle_request( | ||||||||||||||||||||
| 29 | 'POST', | ||||||||||||||||||||
| 30 | $self->{uri}, | ||||||||||||||||||||
| 31 | 1 | 'create', | |||||||||||||||||||
| 32 | { | ||||||||||||||||||||
| 33 | data => $data, | ||||||||||||||||||||
| 34 | headers => { 'Content-Type' => 'application/json', } | ||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||
| 37 | return Twilio::Rest::Memory::V1::ProfileInstance->new($self->{version}, $response->get_content, | ||||||||||||||||||||
| 38 | 1 | $self->{solution}{store_id}); | |||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 42 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 43 | 0 | return $self->read_records(@arguments); | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub stream { | ||||||||||||||||||
|
Subroutine
stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 47 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 48 | 0 | return $self->stream_records(@arguments); | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 1 | ▶ | sub page { | ||||||||||||||||||
|
Subroutine
page: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 52 | 1 | my ($self, $options, $page_size, $page_token) = @_; | |||||||||||||||||||
| 53 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | my $params = { | ||||||||||||||||||||
| 56 | orderBy => $options->{order_by}, | ||||||||||||||||||||
| 57 | 1 | pageSize => $page_size, | |||||||||||||||||||
| 58 | pageToken => $page_token, | ||||||||||||||||||||
| 59 | }; | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 62 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 66 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 67 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 68 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 72 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 73 | 1 | return Twilio::Rest::Memory::V1::ProfilePage->new($self->{version}, $response, $self->{solution}); | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | 7 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 77 | 7 | my ($self, $profile_id) = @_; | |||||||||||||||||||
| 78 | return Twilio::Rest::Memory::V1::ProfileContext->new($self->{version}, | ||||||||||||||||||||
| 79 | 7 | $self->{solution}{store_id}, $profile_id); | |||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | package Twilio::Rest::Memory::V1::ProfilePage; | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 3 | ▶ | use parent 'Twilio::TokenPaginationPage'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 1 | ▶ | sub records_key { return 'profiles' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 89 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 90 | return Twilio::Rest::Memory::V1::ProfileInstance->new($self->{version}, $payload, | ||||||||||||||||||||
| 91 | 1 | $self->{solution}{store_id}); | |||||||||||||||||||
| 92 | } | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | package Twilio::Rest::Memory::V1::ProfileContext; | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 3 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 3 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | 7 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 101 | 7 | my ($class, $version, $store_id, $profile_id) = @_; | |||||||||||||||||||
| 102 | 7 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 103 | 7 | $self->{solution} = { store_id => $store_id, profile_id => $profile_id }; | |||||||||||||||||||
| 104 | 7 | $self->{uri} = join q{}, '/Stores/', Twilio::Serialize::path_segment($store_id), '/Profiles/', | |||||||||||||||||||
| 105 | Twilio::Serialize::path_segment($profile_id); | ||||||||||||||||||||
| 106 | 7 | return $self; | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | 2 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 110 | 2 | my ($self) = @_; | |||||||||||||||||||
| 111 | 2 | my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete'); | |||||||||||||||||||
| 112 | 2 | my $status = $response->get_status_code; | |||||||||||||||||||
| 113 | return Twilio::Rest::Memory::V1::DeleteProfile202ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 114 | 2 | ▶ | $response->get_content) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 115 | if $status == 202; | ||||||||||||||||||||
| 116 | return Twilio::Rest::Memory::V1::FetchProfile301ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 117 | 1 | $response->get_content); | |||||||||||||||||||
| 118 | } | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | 3 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 121 | 3 | my ($self, $options) = @_; | |||||||||||||||||||
| 122 | 3 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition100%2/2
$options //= {}
MC/DC100%1/1
$options //= {}
$options
Truth table100%2/2
A
A= $options
| |||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch', | ||||||||||||||||||||
| 125 | 3 | { params => { traitGroups => $options->{trait_groups}, } }); | |||||||||||||||||||
| 126 | 3 | my $status = $response->get_status_code; | |||||||||||||||||||
| 127 | return Twilio::Rest::Memory::V1::FetchProfile301ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 128 | 3 | ▶ | $response->get_content) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 129 | if $status == 301; | ||||||||||||||||||||
| 130 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 131 | } | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | 2 | ▶ | sub patch { | ||||||||||||||||||
|
Subroutine
patch: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 134 | 2 | my ($self, $body) = @_; | |||||||||||||||||||
| 135 | |||||||||||||||||||||
| 136 | 2 | my $data = Twilio::Serialize::json_body($body, {}); | |||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | my $response = $self->{version}->handle_request( | ||||||||||||||||||||
| 139 | 'PATCH', | ||||||||||||||||||||
| 140 | $self->{uri}, | ||||||||||||||||||||
| 141 | 2 | 'patch', | |||||||||||||||||||
| 142 | { | ||||||||||||||||||||
| 143 | data => $data, | ||||||||||||||||||||
| 144 | headers => { 'Content-Type' => 'application/json', } | ||||||||||||||||||||
| 145 | } | ||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||
| 147 | 2 | my $status = $response->get_status_code; | |||||||||||||||||||
| 148 | return Twilio::Rest::Memory::V1::FetchProfile301ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 149 | 2 | ▶ | $response->get_content) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 150 | if $status == 308; | ||||||||||||||||||||
| 151 | return Twilio::Rest::Memory::V1::PatchProfileTraits202ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 152 | 1 | $response->get_content); | |||||||||||||||||||
| 153 | } | ||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | 1 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 156 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 157 | return Twilio::Rest::Memory::V1::ProfileInstance->new( | ||||||||||||||||||||
| 158 | $self->{version}, $response->get_content, | ||||||||||||||||||||
| 159 | $self->{solution}{store_id}, $self->{solution}{profile_id} | ||||||||||||||||||||
| 160 | 1 | ); | |||||||||||||||||||
| 161 | } | ||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | package Twilio::Rest::Memory::V1::ProfileInstance; | ||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | 3 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 3 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 170 | 3 | my ($class, $version, $payload, $store_id, $profile_id) = @_; | |||||||||||||||||||
| 171 | 3 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 172 | $self->{solution} = | ||||||||||||||||||||
| 173 | 3 | ▶ | { store_id => $store_id, profile_id => $profile_id // $self->{properties}{id} }; | ||||||||||||||||||
|
Condition100%3/3
$profile_id // $self->{"properties"}{"id"}
MC/DC100%2/2
$profile_id // $self->{"properties"}{"id"}
$profile_id
$self->{"properties"}{"id"}
Truth table100%3/3
A // B
A= $profile_idB= $self->{"properties"}{"id"}
| |||||||||||||||||||||
| 174 | 3 | return $self; | |||||||||||||||||||
| 175 | } | ||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | 0 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 178 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 179 | 0 | return $self->_context->delete(@arguments); | |||||||||||||||||||
| 180 | } | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 183 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 184 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 185 | } | ||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | 0 | ▶ | sub patch { | ||||||||||||||||||
|
Subroutine
patch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 188 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 189 | 0 | return $self->_context->patch(@arguments); | |||||||||||||||||||
| 190 | } | ||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 193 | 0 | my ($self) = @_; | |||||||||||||||||||
| 194 | return Twilio::Rest::Memory::V1::ProfileContext->new( | ||||||||||||||||||||
| 195 | $self->{version}, | ||||||||||||||||||||
| 196 | $self->{solution}{store_id}, | ||||||||||||||||||||
| 197 | $self->{solution}{profile_id} | ||||||||||||||||||||
| 198 | 0 | ); | |||||||||||||||||||
| 199 | } | ||||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | 1 | ▶ | sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) } | ||||||||||||||||||
|
Subroutine
created_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 202 | 2 | ▶ | sub id { return $_[0]{properties}{id} } | ||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 203 | 1 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 204 | 1 | ▶ | sub traits { return $_[0]{properties}{traits} } | ||||||||||||||||||
|
Subroutine
traits: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | package Twilio::Rest::Memory::V1::FetchProfile301ResponseInstance; | ||||||||||||||||||||
| 207 | |||||||||||||||||||||
| 208 | 3 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 209 | |||||||||||||||||||||
| 210 | 3 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 211 | |||||||||||||||||||||
| 212 | 3 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 213 | 4 | ▶ | sub uri { return $_[0]{properties}{uri} } | ||||||||||||||||||
|
Subroutine
uri: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | package Twilio::Rest::Memory::V1::PatchProfileTraits202ResponseInstance; | ||||||||||||||||||||
| 216 | |||||||||||||||||||||
| 217 | 3 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 218 | |||||||||||||||||||||
| 219 | 3 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 220 | |||||||||||||||||||||
| 221 | 1 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 222 | |||||||||||||||||||||
| 223 | package Twilio::Rest::Memory::V1::DeleteProfile202ResponseInstance; | ||||||||||||||||||||
| 224 | |||||||||||||||||||||
| 225 | 3 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | 3 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 228 | |||||||||||||||||||||
| 229 | 1 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 230 | |||||||||||||||||||||
| 231 | 3 | 1; | |||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | __END__ | ||||||||||||||||||||