| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Sync::V1::Service::SyncList::SyncListItem; | ||||||||||||||||||||
| 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::Sync::V1::Service::SyncList::SyncListItemList; | ||||||||||||||||||||
| 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 | 6 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 6 | my ($class, $version, $service_sid, $list_sid) = @_; | |||||||||||||||||||
| 17 | 6 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 6 | $self->{solution} = { service_sid => $service_sid, list_sid => $list_sid }; | |||||||||||||||||||
| 19 | 6 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Lists/', | |||||||||||||||||||
| 20 | Twilio::Serialize::path_segment($list_sid), '/Items'; | ||||||||||||||||||||
| 21 | 6 | return $self; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | ▶ | sub create { | ||||||||||||||||||
|
Subroutine
create: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 25 | 2 | my ($self, $data_value, $options) = @_; | |||||||||||||||||||
| 26 | 2 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition100%2/2
$options //= {}
MC/DC100%1/1
$options //= {}
$options
Truth table100%2/2
A
A= $options
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | my $data = { | ||||||||||||||||||||
| 29 | Data => Twilio::Serialize::json_object($data_value), | ||||||||||||||||||||
| 30 | CollectionTtl => $options->{collection_ttl}, | ||||||||||||||||||||
| 31 | ItemTtl => $options->{item_ttl}, | ||||||||||||||||||||
| 32 | Ttl => $options->{ttl}, | ||||||||||||||||||||
| 33 | 2 | }; | |||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | my $response = | ||||||||||||||||||||
| 36 | 2 | $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data }); | |||||||||||||||||||
| 37 | return Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemInstance->new( | ||||||||||||||||||||
| 38 | $self->{version}, $response->get_content, | ||||||||||||||||||||
| 39 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 40 | $self->{solution}{list_sid} | ||||||||||||||||||||
| 41 | 2 | ); | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 45 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 46 | 0 | return $self->read_records(@arguments); | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | ▶ | sub stream { | ||||||||||||||||||
|
Subroutine
stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 50 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 51 | 0 | return $self->stream_records(@arguments); | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 1 | ▶ | sub page { | ||||||||||||||||||
|
Subroutine
page: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 55 | 1 | my ($self, $options, $page_size, $page_token, $page_number) = @_; | |||||||||||||||||||
| 56 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | my $params = { | ||||||||||||||||||||
| 59 | Bounds => $options->{bounds}, | ||||||||||||||||||||
| 60 | From => $options->{from}, | ||||||||||||||||||||
| 61 | Order => $options->{order}, | ||||||||||||||||||||
| 62 | 1 | PageToken => $page_token, | |||||||||||||||||||
| 63 | Page => $page_number, | ||||||||||||||||||||
| 64 | PageSize => $page_size, | ||||||||||||||||||||
| 65 | }; | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 68 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 72 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 73 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 74 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 78 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 79 | return Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemPage->new($self->{version}, | ||||||||||||||||||||
| 80 | 1 | $response, $self->{solution}); | |||||||||||||||||||
| 81 | } | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 3 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 84 | 3 | my ($self, $index) = @_; | |||||||||||||||||||
| 85 | return Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemContext->new( | ||||||||||||||||||||
| 86 | $self->{version}, | ||||||||||||||||||||
| 87 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 88 | 3 | $self->{solution}{list_sid}, $index | |||||||||||||||||||
| 89 | ); | ||||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | package Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemPage; | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | 3 | ▶ | use parent 'Twilio::Page'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 1 | ▶ | sub records_key { return 'items' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 99 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 100 | return Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemInstance->new( | ||||||||||||||||||||
| 101 | $self->{version}, $payload, | ||||||||||||||||||||
| 102 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 103 | $self->{solution}{list_sid} | ||||||||||||||||||||
| 104 | 1 | ); | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | package Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemContext; | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | 3 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | 3 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 114 | 3 | my ($class, $version, $service_sid, $list_sid, $index) = @_; | |||||||||||||||||||
| 115 | 3 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 116 | 3 | $self->{solution} = { service_sid => $service_sid, list_sid => $list_sid, index => $index }; | |||||||||||||||||||
| 117 | 3 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Lists/', | |||||||||||||||||||
| 118 | Twilio::Serialize::path_segment($list_sid), '/Items/', Twilio::Serialize::path_segment($index); | ||||||||||||||||||||
| 119 | 3 | return $self; | |||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | 1 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 123 | 1 | my ($self, $options) = @_; | |||||||||||||||||||
| 124 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 125 | $self->{version}->handle_request('DELETE', $self->{uri}, 'delete', | ||||||||||||||||||||
| 126 | 1 | { headers => { 'If-Match' => $options->{if_match}, } }); | |||||||||||||||||||
| 127 | 1 | return 1; | |||||||||||||||||||
| 128 | } | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | 1 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 131 | 1 | my ($self) = @_; | |||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | 1 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch'); | |||||||||||||||||||
| 134 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 135 | } | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | 1 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 138 | 1 | my ($self, $options) = @_; | |||||||||||||||||||
| 139 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | my $data = { | ||||||||||||||||||||
| 142 | CollectionTtl => $options->{collection_ttl}, | ||||||||||||||||||||
| 143 | Data => Twilio::Serialize::json_object($options->{data}), | ||||||||||||||||||||
| 144 | ItemTtl => $options->{item_ttl}, | ||||||||||||||||||||
| 145 | Ttl => $options->{ttl}, | ||||||||||||||||||||
| 146 | 1 | }; | |||||||||||||||||||
| 147 | |||||||||||||||||||||
| 148 | my $response = $self->{version}->handle_request( | ||||||||||||||||||||
| 149 | 'POST', | ||||||||||||||||||||
| 150 | $self->{uri}, | ||||||||||||||||||||
| 151 | 'update', | ||||||||||||||||||||
| 152 | { | ||||||||||||||||||||
| 153 | data => $data, | ||||||||||||||||||||
| 154 | headers => { 'If-Match' => $options->{if_match}, } | ||||||||||||||||||||
| 155 | } | ||||||||||||||||||||
| 156 | 1 | ); | |||||||||||||||||||
| 157 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 158 | } | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | 2 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 161 | 2 | my ($self, $response) = @_; | |||||||||||||||||||
| 162 | return Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemInstance->new( | ||||||||||||||||||||
| 163 | $self->{version}, $response->get_content, | ||||||||||||||||||||
| 164 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 165 | $self->{solution}{list_sid}, | ||||||||||||||||||||
| 166 | $self->{solution}{index} | ||||||||||||||||||||
| 167 | 2 | ); | |||||||||||||||||||
| 168 | } | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | package Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemInstance; | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | 3 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | 3 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | 5 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 177 | 5 | my ($class, $version, $payload, $service_sid, $list_sid, $index) = @_; | |||||||||||||||||||
| 178 | 5 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 179 | $self->{solution} = { | ||||||||||||||||||||
| 180 | service_sid => $service_sid, | ||||||||||||||||||||
| 181 | list_sid => $list_sid, | ||||||||||||||||||||
| 182 | index => $index // $self->{properties}{index} | ||||||||||||||||||||
| 183 | 5 | ▶ | }; | ||||||||||||||||||
|
Condition66%2/3
$index // $self->{"properties"}{"index"}
MC/DC0%0/2
$index // $self->{"properties"}{"index"}
$index
$self->{"properties"}{"index"}
Truth table66%2/3
A // B
A= $indexB= $self->{"properties"}{"index"}
| |||||||||||||||||||||
| 184 | 5 | return $self; | |||||||||||||||||||
| 185 | } | ||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | 0 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 188 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 189 | 0 | return $self->_context->delete(@arguments); | |||||||||||||||||||
| 190 | } | ||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 193 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 194 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 195 | } | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 0 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 198 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 199 | 0 | return $self->_context->update(@arguments); | |||||||||||||||||||
| 200 | } | ||||||||||||||||||||
| 201 | |||||||||||||||||||||
| 202 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 203 | 0 | my ($self) = @_; | |||||||||||||||||||
| 204 | return Twilio::Rest::Sync::V1::Service::SyncList::SyncListItemContext->new( | ||||||||||||||||||||
| 205 | $self->{version}, $self->{solution}{service_sid}, | ||||||||||||||||||||
| 206 | $self->{solution}{list_sid}, $self->{solution}{index} | ||||||||||||||||||||
| 207 | 0 | ); | |||||||||||||||||||
| 208 | } | ||||||||||||||||||||
| 209 | |||||||||||||||||||||
| 210 | 4 | ▶ | sub account_sid { return $_[0]{properties}{account_sid} } | ||||||||||||||||||
|
Subroutine
account_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 211 | 4 | ▶ | sub created_by { return $_[0]{properties}{created_by} } | ||||||||||||||||||
|
Subroutine
created_by: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 212 | 4 | ▶ | sub data { return $_[0]{properties}{data} } | ||||||||||||||||||
|
Subroutine
data: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 213 | 4 | ▶ | sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) } | ||||||||||||||||||
|
Subroutine
date_created: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 214 | 4 | ▶ | sub date_expires { return Twilio::Deserialize::date_time($_[0]{properties}{date_expires}) } | ||||||||||||||||||
|
Subroutine
date_expires: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 215 | 4 | ▶ | sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) } | ||||||||||||||||||
|
Subroutine
date_updated: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 216 | 4 | ▶ | sub index { return $_[0]{properties}{index} } | ||||||||||||||||||
|
Subroutine
index: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 217 | 4 | ▶ | sub list_sid { return $_[0]{properties}{list_sid} } | ||||||||||||||||||
|
Subroutine
list_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 218 | 4 | ▶ | sub revision { return $_[0]{properties}{revision} } | ||||||||||||||||||
|
Subroutine
revision: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 219 | 4 | ▶ | sub service_sid { return $_[0]{properties}{service_sid} } | ||||||||||||||||||
|
Subroutine
service_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 220 | 4 | ▶ | sub url { return $_[0]{properties}{url} } | ||||||||||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | 3 | 1; | |||||||||||||||||||
| 223 | |||||||||||||||||||||
| 224 | __END__ | ||||||||||||||||||||