Twilio/Rest/Verify/V2/Service/Webhook.pm

filter: Statementstmt 84.8% 84 / 99 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 82.9% 34 / 41 Podpod n/a totaltotal 79.8% 123 / 154 CC 5 SCAR 2.9
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Proxy/V1/Service/PhoneNumber.pm ↑ Summary Twilio/Rest/Chat/V2/Service/Channel/Message.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Verify::V2::Service::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::Verify::V2::Service::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, $service_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { service_sid => $service_sid };
19 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Webhooks';
20 5 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $friendly_name, $event_types, $webhook_url, $options) = @_;
25 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
26  
27 my $data = {
28 FriendlyName => $friendly_name,
29 EventTypes => $event_types,
30 WebhookUrl => $webhook_url,
31 Status => $options->{status},
32 Version => $options->{version},
33 1 };
34  
35 my $response =
36 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
37 return Twilio::Rest::Verify::V2::Service::WebhookInstance->new($self->{version},
38 1 $response->get_content, $self->{solution}{service_sid});
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, $page_number) = @_;
53 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
54  
55 1 my $params = {
56 PageToken => $page_token,
57 Page => $page_number,
58 PageSize => $page_size,
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 return Twilio::Rest::Verify::V2::Service::WebhookPage->new($self->{version}, $response,
74 1 $self->{solution});
75 }
76  
77 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
78 3 my ($self, $sid) = @_;
79 return Twilio::Rest::Verify::V2::Service::WebhookContext->new($self->{version},
80 3 $self->{solution}{service_sid}, $sid);
81 }
82  
83 package Twilio::Rest::Verify::V2::Service::WebhookPage;
84  
85 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'webhooks' }
Subroutine records_key: called CC=1 SCAR=0.0
88  
89 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
90 1 my ($self, $payload) = @_;
91 return Twilio::Rest::Verify::V2::Service::WebhookInstance->new($self->{version}, $payload,
92 1 $self->{solution}{service_sid});
93 }
94  
95 package Twilio::Rest::Verify::V2::Service::WebhookContext;
96  
97 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 3 my ($class, $version, $service_sid, $sid) = @_;
103 3 my $self = $class->SUPER::new($version);
104 3 $self->{solution} = { service_sid => $service_sid, sid => $sid };
105 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
106 '/Webhooks/', Twilio::Serialize::path_segment($sid);
107 3 return $self;
108 }
109  
110 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
111 1 my ($self) = @_;
112 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
113 1 return 1;
114 }
115  
116 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
117 1 my ($self) = @_;
118  
119 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
120 1 return $self->_build_instance($response);
121 }
122  
123 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
124 1 my ($self, $options) = @_;
125 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
126  
127 my $data = {
128 EventTypes => $options->{event_types},
129 FriendlyName => $options->{friendly_name},
130 Status => $options->{status},
131 Version => $options->{version},
132 WebhookUrl => $options->{webhook_url},
133 1 };
134  
135 my $response =
136 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
137 1 return $self->_build_instance($response);
138 }
139  
140 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
141 2 my ($self, $response) = @_;
142 return Twilio::Rest::Verify::V2::Service::WebhookInstance->new(
143 $self->{version}, $response->get_content,
144 $self->{solution}{service_sid}, $self->{solution}{sid}
145 2 );
146 }
147  
148 package Twilio::Rest::Verify::V2::Service::WebhookInstance;
149  
150 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
151  
152 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
153  
154 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
155 4 my ($class, $version, $payload, $service_sid, $sid) = @_;
156 4 my $self = $class->SUPER::new($version, $payload);
157 4 ▶ $self->{solution} = { service_sid => $service_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
158 4 return $self;
159 }
160  
161 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
162 0 my ($self, @arguments) = @_;
163 0 return $self->_context->delete(@arguments);
164 }
165  
166 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
167 0 my ($self, @arguments) = @_;
168 0 return $self->_context->fetch(@arguments);
169 }
170  
171 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->update(@arguments);
174 }
175  
176 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
177 0 my ($self) = @_;
178 return Twilio::Rest::Verify::V2::Service::WebhookContext->new(
179 $self->{version},
180 $self->{solution}{service_sid},
181 $self->{solution}{sid}
182 0 );
183 }
184  
185 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
186 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
187 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
188 4 ▶sub event_types { return $_[0]{properties}{event_types} }
Subroutine event_types: called CC=1 SCAR=0.0
189 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
190 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
191 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
192 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
193 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
194 4 ▶sub version { return $_[0]{properties}{version} }
Subroutine version: called CC=1 SCAR=0.0
195 4 ▶sub webhook_method { return $_[0]{properties}{webhook_method} }
Subroutine webhook_method: called CC=1 SCAR=0.0
196 4 ▶sub webhook_url { return $_[0]{properties}{webhook_url} }
Subroutine webhook_url: called CC=1 SCAR=0.0
197  
198 2 1;
199  
200 __END__
« Twilio/Rest/Proxy/V1/Service/PhoneNumber.pm ↑ Summary Twilio/Rest/Chat/V2/Service/Channel/Message.pm »