Twilio/Rest/Conversations/V1/Conversation/Webhook.pm

filter: Statementstmt 84.2% 80 / 95 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 81.0% 30 / 37 Podpod n/a totaltotal 78.7% 115 / 146 CC 5 SCAR 3.1
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Chat/V2/Credential.pm ↑ Summary Twilio/Rest/Conversations/V1/Credential.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::Conversation::Webhook;
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::V1::Conversation::WebhookList;
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 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 5 my ($class, $version, $conversation_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { conversation_sid => $conversation_sid };
19 5 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_sid),
20 '/Webhooks';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $target, $options) = @_;
26 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
27  
28 my $data = {
29 Target => $target,
30 'Configuration.Filters' => $options->{configuration_filters},
31 'Configuration.FlowSid' => $options->{configuration_flow_sid},
32 'Configuration.Method' => $options->{configuration_method},
33 'Configuration.ReplayAfter' => $options->{configuration_replay_after},
34 'Configuration.Triggers' => $options->{configuration_triggers},
35 'Configuration.Url' => $options->{configuration_url},
36 1 };
37  
38 my $response =
39 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
40 return Twilio::Rest::Conversations::V1::Conversation::WebhookInstance->new($self->{version},
41 1 $response->get_content, $self->{solution}{conversation_sid});
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 //= {}
l!l
01
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
57  
58 1 my $params = {
59 PageToken => $page_token,
60 Page => $page_number,
61 PageSize => $page_size,
62 };
63  
64 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
65 1 return $self->_build_page($response);
66 }
67  
68 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
69 0 my ($self, $target_url) = @_;
70 0 my $client = $self->{version}->get_domain->get_client;
71 0 return $self->_build_page($client->request('GET', $target_url));
72 }
73  
74 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
75 1 my ($self, $response) = @_;
76 return Twilio::Rest::Conversations::V1::Conversation::WebhookPage->new($self->{version},
77 1 $response, $self->{solution});
78 }
79  
80 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
81 3 my ($self, $sid) = @_;
82 return Twilio::Rest::Conversations::V1::Conversation::WebhookContext->new($self->{version},
83 3 $self->{solution}{conversation_sid}, $sid);
84 }
85  
86 package Twilio::Rest::Conversations::V1::Conversation::WebhookPage;
87  
88 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 1 ▶sub records_key { return 'webhooks' }
Subroutine records_key: called CC=1 SCAR=0.0
91  
92 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
93 1 my ($self, $payload) = @_;
94 return Twilio::Rest::Conversations::V1::Conversation::WebhookInstance->new($self->{version},
95 1 $payload, $self->{solution}{conversation_sid});
96 }
97  
98 package Twilio::Rest::Conversations::V1::Conversation::WebhookContext;
99  
100 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
105 3 my ($class, $version, $conversation_sid, $sid) = @_;
106 3 my $self = $class->SUPER::new($version);
107 3 $self->{solution} = { conversation_sid => $conversation_sid, sid => $sid };
108 3 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_sid),
109 '/Webhooks/', Twilio::Serialize::path_segment($sid);
110 3 return $self;
111 }
112  
113 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
114 1 my ($self) = @_;
115 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
116 1 return 1;
117 }
118  
119 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
120 1 my ($self) = @_;
121  
122 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
123 1 return $self->_build_instance($response);
124 }
125  
126 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
127 1 my ($self, $options) = @_;
128 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
129  
130 my $data = {
131 'Configuration.Filters' => $options->{configuration_filters},
132 'Configuration.FlowSid' => $options->{configuration_flow_sid},
133 'Configuration.Method' => $options->{configuration_method},
134 'Configuration.Triggers' => $options->{configuration_triggers},
135 'Configuration.Url' => $options->{configuration_url},
136 1 };
137  
138 my $response =
139 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
140 1 return $self->_build_instance($response);
141 }
142  
143 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
144 2 my ($self, $response) = @_;
145 return Twilio::Rest::Conversations::V1::Conversation::WebhookInstance->new(
146 $self->{version}, $response->get_content,
147 $self->{solution}{conversation_sid},
148 $self->{solution}{sid}
149 2 );
150 }
151  
152 package Twilio::Rest::Conversations::V1::Conversation::WebhookInstance;
153  
154 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
159 4 my ($class, $version, $payload, $conversation_sid, $sid) = @_;
160 4 my $self = $class->SUPER::new($version, $payload);
161 $self->{solution} =
162 4 ▶ { conversation_sid => $conversation_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
220
MC/DC0%0/2
$sid // $self->{"properties"}{"sid"}
$sid $self->{"properties"}{"sid"}
Truth table66%2/3
A // B
A= $sidB= $self->{"properties"}{"sid"}
ABresult
1X1
011
000
163 4 return $self;
164 }
165  
166 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
167 0 my ($self, @arguments) = @_;
168 0 return $self->_context->delete(@arguments);
169 }
170  
171 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->fetch(@arguments);
174 }
175  
176 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
177 0 my ($self, @arguments) = @_;
178 0 return $self->_context->update(@arguments);
179 }
180  
181 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
182 0 my ($self) = @_;
183 return Twilio::Rest::Conversations::V1::Conversation::WebhookContext->new(
184 $self->{version},
185 $self->{solution}{conversation_sid},
186 $self->{solution}{sid}
187 0 );
188 }
189  
190 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
191 4 ▶sub configuration { return $_[0]{properties}{configuration} }
Subroutine configuration: called CC=1 SCAR=0.0
192 4 ▶sub conversation_sid { return $_[0]{properties}{conversation_sid} }
Subroutine conversation_sid: called CC=1 SCAR=0.0
193 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
194 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
195 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
196 4 ▶sub target { return $_[0]{properties}{target} }
Subroutine target: called CC=1 SCAR=0.0
197 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
198  
199 2 1;
200  
201 __END__
« Twilio/Rest/Chat/V2/Credential.pm ↑ Summary Twilio/Rest/Conversations/V1/Credential.pm »