| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Conversations::V2::Communication; | ||||||||||||||||||||
| 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::Conversations::V2::CommunicationList; | ||||||||||||||||||||
| 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, $conversation_id) = @_; | |||||||||||||||||||
| 17 | 3 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 3 | $self->{solution} = { conversation_id => $conversation_id }; | |||||||||||||||||||
| 19 | 3 | $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_id), | |||||||||||||||||||
| 20 | '/Communications'; | ||||||||||||||||||||
| 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, { 'occurredAt' => 'iso8601_date_time' }); | |||||||||||||||||||
| 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::Conversations::V2::CommunicationInstance->new($self->{version}, | ||||||||||||||||||||
| 39 | 1 | $response->get_content, $self->{solution}{conversation_id}); | |||||||||||||||||||
| 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) = @_; | |||||||||||||||||||
| 54 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | my $params = { | ||||||||||||||||||||
| 57 | channelId => $options->{channel_id}, | ||||||||||||||||||||
| 58 | 1 | pageSize => $page_size, | |||||||||||||||||||
| 59 | pageToken => $page_token, | ||||||||||||||||||||
| 60 | }; | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 63 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 67 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 68 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 69 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 70 | } | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 73 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 74 | return Twilio::Rest::Conversations::V2::CommunicationPage->new($self->{version}, $response, | ||||||||||||||||||||
| 75 | 1 | $self->{solution}); | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 1 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 79 | 1 | my ($self, $id) = @_; | |||||||||||||||||||
| 80 | return Twilio::Rest::Conversations::V2::CommunicationContext->new($self->{version}, | ||||||||||||||||||||
| 81 | 1 | $self->{solution}{conversation_id}, $id); | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | package Twilio::Rest::Conversations::V2::CommunicationPage; | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 2 | ▶ | use parent 'Twilio::TokenPaginationPage'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 1 | ▶ | sub records_key { return 'communications' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 91 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 92 | return Twilio::Rest::Conversations::V2::CommunicationInstance->new($self->{version}, $payload, | ||||||||||||||||||||
| 93 | 1 | $self->{solution}{conversation_id}); | |||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | package Twilio::Rest::Conversations::V2::CommunicationContext; | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 2 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | 2 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 103 | 1 | my ($class, $version, $conversation_id, $id) = @_; | |||||||||||||||||||
| 104 | 1 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 105 | 1 | $self->{solution} = { conversation_id => $conversation_id, id => $id }; | |||||||||||||||||||
| 106 | 1 | $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_id), | |||||||||||||||||||
| 107 | '/Communications/', Twilio::Serialize::path_segment($id); | ||||||||||||||||||||
| 108 | 1 | return $self; | |||||||||||||||||||
| 109 | } | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | 1 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 112 | 1 | my ($self) = @_; | |||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 1 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch'); | |||||||||||||||||||
| 115 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 116 | } | ||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | 1 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 119 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 120 | return Twilio::Rest::Conversations::V2::CommunicationInstance->new( | ||||||||||||||||||||
| 121 | $self->{version}, $response->get_content, | ||||||||||||||||||||
| 122 | $self->{solution}{conversation_id}, | ||||||||||||||||||||
| 123 | $self->{solution}{id} | ||||||||||||||||||||
| 124 | 1 | ); | |||||||||||||||||||
| 125 | } | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | package Twilio::Rest::Conversations::V2::CommunicationInstance; | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 134 | 3 | my ($class, $version, $payload, $conversation_id, $id) = @_; | |||||||||||||||||||
| 135 | 3 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 136 | 3 | ▶ | $self->{solution} = { conversation_id => $conversation_id, id => $id // $self->{properties}{id} }; | ||||||||||||||||||
|
Condition66%2/3
$id // $self->{"properties"}{"id"}
MC/DC0%0/2
$id // $self->{"properties"}{"id"}
$id
$self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $idB= $self->{"properties"}{"id"}
| |||||||||||||||||||||
| 137 | 3 | return $self; | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 141 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 142 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 143 | } | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 146 | 0 | my ($self) = @_; | |||||||||||||||||||
| 147 | return Twilio::Rest::Conversations::V2::CommunicationContext->new( | ||||||||||||||||||||
| 148 | $self->{version}, | ||||||||||||||||||||
| 149 | $self->{solution}{conversation_id}, | ||||||||||||||||||||
| 150 | $self->{solution}{id} | ||||||||||||||||||||
| 151 | 0 | ); | |||||||||||||||||||
| 152 | } | ||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | 3 | ▶ | sub account_id { return $_[0]{properties}{accountId} } | ||||||||||||||||||
|
Subroutine
account_id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 155 | 3 | ▶ | sub author { return $_[0]{properties}{author} } | ||||||||||||||||||
|
Subroutine
author: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 156 | 3 | ▶ | sub channel_id { return $_[0]{properties}{channelId} } | ||||||||||||||||||
|
Subroutine
channel_id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 157 | 3 | ▶ | sub content { return $_[0]{properties}{content} } | ||||||||||||||||||
|
Subroutine
content: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 158 | 3 | ▶ | sub conversation_id { return $_[0]{properties}{conversationId} } | ||||||||||||||||||
|
Subroutine
conversation_id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 159 | 3 | ▶ | sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) } | ||||||||||||||||||
|
Subroutine
created_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 160 | 3 | ▶ | sub id { return $_[0]{properties}{id} } | ||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 161 | 3 | ▶ | sub occurred_at { return Twilio::Deserialize::date_time($_[0]{properties}{occurredAt}) } | ||||||||||||||||||
|
Subroutine
occurred_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 162 | 3 | ▶ | sub recipients { return $_[0]{properties}{recipients} } | ||||||||||||||||||
|
Subroutine
recipients: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 163 | 3 | ▶ | sub resource_id { return $_[0]{properties}{resourceId} } | ||||||||||||||||||
|
Subroutine
resource_id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 164 | 3 | ▶ | sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) } | ||||||||||||||||||
|
Subroutine
updated_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 165 | |||||||||||||||||||||
| 166 | 2 | 1; | |||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | __END__ | ||||||||||||||||||||