Twilio/Rest/Intelligence/V3/Conversation.pm

filter: Statementstmt 86.7% 72 / 83 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 86.4% 32 / 37 Podpod n/a totaltotal 83.5% 107 / 128 CC 3 SCAR 2.1
CC
3
Cov
85%
page
2.0
new
2.0
read
2.0
CRAP 1.2
« Twilio/Rest/Serverless/V1/Service/Environment/Log.pm ↑ Summary Twilio/Rest/Memory/V1/Import.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Intelligence::V3::Conversation;
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::Intelligence::V3::ConversationList;
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 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 2 my ($class, $version) = @_;
17 2 my $self = $class->SUPER::new($version);
18 2 $self->{solution} = {};
19 2 $self->{uri} = '/Conversations';
20 2 return $self;
21 }
22  
23 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
24 0 my ($self, @arguments) = @_;
25 0 return $self->read_records(@arguments);
26 }
27  
28 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
29 0 my ($self, @arguments) = @_;
30 0 return $self->stream_records(@arguments);
31 }
32  
33 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
34 1 my ($self, $options, $page_size, $page_token) = @_;
35 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
36  
37 my $params = {
38 channelId => $options->{channel_id},
39 channels => $options->{channels},
40 conversationConfigurationId => $options->{conversation_configuration_id},
41 createdAtAfter => Twilio::Serialize::iso8601_date_time($options->{created_at_after}),
42 createdAtBefore => Twilio::Serialize::iso8601_date_time($options->{created_at_before}),
43 intelligenceConfigurationIds => $options->{intelligence_configuration_ids},
44 operatorIds => $options->{operator_ids},
45 status => $options->{status},
46 1 pageSize => $page_size,
47 pageToken => $page_token,
48 };
49  
50 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
51 1 return $self->_build_page($response);
52 }
53  
54 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
55 0 my ($self, $target_url) = @_;
56 0 my $client = $self->{version}->get_domain->get_client;
57 0 return $self->_build_page($client->request('GET', $target_url));
58 }
59  
60 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
61 1 my ($self, $response) = @_;
62 return Twilio::Rest::Intelligence::V3::ConversationPage->new($self->{version}, $response,
63 1 $self->{solution});
64 }
65  
66 1 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
67 1 my ($self, $id) = @_;
68 1 return Twilio::Rest::Intelligence::V3::ConversationContext->new($self->{version}, $id);
69 }
70  
71 package Twilio::Rest::Intelligence::V3::ConversationPage;
72  
73 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
74  
75 1 ▶sub records_key { return 'items' }
Subroutine records_key: called CC=1 SCAR=0.0
76  
77 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
78 1 my ($self, $payload) = @_;
79 1 return Twilio::Rest::Intelligence::V3::ConversationInstance->new($self->{version}, $payload);
80 }
81  
82 package Twilio::Rest::Intelligence::V3::ConversationContext;
83  
84 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
89 1 my ($class, $version, $id) = @_;
90 1 my $self = $class->SUPER::new($version);
91 1 $self->{solution} = { id => $id };
92 1 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($id);
93 1 return $self;
94 }
95  
96 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
97 1 my ($self) = @_;
98  
99 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
100 1 return $self->_build_instance($response);
101 }
102  
103 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
104 1 my ($self, $response) = @_;
105 return Twilio::Rest::Intelligence::V3::ConversationInstance->new($self->{version},
106 1 $response->get_content, $self->{solution}{id});
107 }
108  
109 package Twilio::Rest::Intelligence::V3::ConversationInstance;
110  
111 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
112  
113 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
114  
115 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
116 2 my ($class, $version, $payload, $id) = @_;
117 2 my $self = $class->SUPER::new($version, $payload);
118 2 ▶ $self->{solution} = { id => $id // $self->{properties}{id} };
Condition66%2/3
$id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$id // $self->{"properties"}{"id"}
$id $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
119 2 return $self;
120 }
121  
122 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
123 0 my ($self, @arguments) = @_;
124 0 return $self->_context->fetch(@arguments);
125 }
126  
127 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
128 0 my ($self) = @_;
129 return Twilio::Rest::Intelligence::V3::ConversationContext->new($self->{version},
130 0 $self->{solution}{id});
131 }
132  
133 2 ▶sub account_id { return $_[0]{properties}{accountId} }
Subroutine account_id: called CC=1 SCAR=0.0
134 2 ▶sub channel_ids { return $_[0]{properties}{channelIds} }
Subroutine channel_ids: called CC=1 SCAR=0.0
135 2 ▶sub channels { return $_[0]{properties}{channels} }
Subroutine channels: called CC=1 SCAR=0.0
136 1 ▶sub communications { return $_[0]{properties}{communications} }
Subroutine communications: called CC=1 SCAR=0.0
137 2 ▶sub conversation_configuration_id { return $_[0]{properties}{conversationConfigurationId} }
Subroutine conversation_configuration_id: called CC=1 SCAR=0.0
138 2 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
139 2 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
140 2 ▶sub intelligence_configuration_ids { return $_[0]{properties}{intelligenceConfigurationIds} }
Subroutine intelligence_configuration_ids: called CC=1 SCAR=0.0
141 2 ▶sub name { return $_[0]{properties}{name} }
Subroutine name: called CC=1 SCAR=0.0
142 2 ▶sub operator_result_ids { return $_[0]{properties}{operatorResultIds} }
Subroutine operator_result_ids: called CC=1 SCAR=0.0
143 2 ▶sub participants { return $_[0]{properties}{participants} }
Subroutine participants: called CC=1 SCAR=0.0
144 2 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
145 2 ▶sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) }
Subroutine updated_at: called CC=1 SCAR=0.0
146  
147 2 1;
148  
149 __END__
« Twilio/Rest/Serverless/V1/Service/Environment/Log.pm ↑ Summary Twilio/Rest/Memory/V1/Import.pm »