Twilio/Rest/Events/V1/Sink.pm

filter: Statementstmt 81.7% 85 / 104 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 78.5% 33 / 42 Podpod n/a totaltotal 78.5% 121 / 154 CC 3 SCAR 2.6
CC
3
Cov
81%
page
2.0
new
2.0
read
2.0
CRAP 1.3
« Twilio/Rest/Api/V2010/Account/Call/Payment.pm ↑ Summary Twilio/Rest/Insights/V1/Call.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Events::V1::Sink;
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::Events::V1::SinkList;
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 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 8 my ($class, $version) = @_;
17 8 my $self = $class->SUPER::new($version);
18 8 $self->{solution} = {};
19 8 $self->{uri} = '/Sinks';
20 8 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
24 1 my ($self, $description, $sink_configuration, $sink_type) = @_;
25  
26 1 my $data = {
27 Description => $description,
28 SinkConfiguration => Twilio::Serialize::json_object($sink_configuration),
29 SinkType => $sink_type,
30 };
31  
32 my $response =
33 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
34 1 return Twilio::Rest::Events::V1::SinkInstance->new($self->{version}, $response->get_content);
35 }
36  
37 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
38 0 my ($self, @arguments) = @_;
39 0 return $self->read_records(@arguments);
40 }
41  
42 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
43 0 my ($self, @arguments) = @_;
44 0 return $self->stream_records(@arguments);
45 }
46  
47 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
48 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
49 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
50  
51 my $params = {
52 InUse => Twilio::Serialize::boolean_to_string($options->{in_use}),
53 Status => $options->{status},
54 1 PageToken => $page_token,
55 Page => $page_number,
56 PageSize => $page_size,
57 };
58  
59 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
60 1 return $self->_build_page($response);
61 }
62  
63 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
64 0 my ($self, $target_url) = @_;
65 0 my $client = $self->{version}->get_domain->get_client;
66 0 return $self->_build_page($client->request('GET', $target_url));
67 }
68  
69 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
70 1 my ($self, $response) = @_;
71 1 return Twilio::Rest::Events::V1::SinkPage->new($self->{version}, $response, $self->{solution});
72 }
73  
74 6 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
75 6 my ($self, $sid) = @_;
76 6 return Twilio::Rest::Events::V1::SinkContext->new($self->{version}, $sid);
77 }
78  
79 package Twilio::Rest::Events::V1::SinkPage;
80  
81 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 1 ▶sub records_key { return 'sinks' }
Subroutine records_key: called CC=1 SCAR=0.0
84  
85 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
86 1 my ($self, $payload) = @_;
87 1 return Twilio::Rest::Events::V1::SinkInstance->new($self->{version}, $payload);
88 }
89  
90 package Twilio::Rest::Events::V1::SinkContext;
91  
92 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
97 6 my ($class, $version, $sid) = @_;
98 6 my $self = $class->SUPER::new($version);
99 6 $self->{solution} = { sid => $sid };
100 6 $self->{uri} = join q{}, '/Sinks/', Twilio::Serialize::path_segment($sid);
101 6 return $self;
102 }
103  
104 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
105 1 my ($self) = @_;
106 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
107 1 return 1;
108 }
109  
110 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
111 1 my ($self) = @_;
112  
113 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
114 1 return $self->_build_instance($response);
115 }
116  
117 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
118 1 my ($self, $description) = @_;
119  
120 1 my $data = { Description => $description, };
121  
122 my $response =
123 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
124 1 return $self->_build_instance($response);
125 }
126  
127 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
128 2 my ($self, $response) = @_;
129 return Twilio::Rest::Events::V1::SinkInstance->new($self->{version}, $response->get_content,
130 2 $self->{solution}{sid});
131 }
132  
133 2 ▶sub sink_test {
Subroutine sink_test: called CC=1 SCAR=0.0
134 2 my ($self) = @_;
135 2 require Twilio::Rest::Events::V1::Sink::SinkTest;
136 return Twilio::Rest::Events::V1::Sink::SinkTestList->new($self->{version},
137 2 $self->{solution}{sid});
138 }
139  
140 1 ▶sub sink_validate {
Subroutine sink_validate: called CC=1 SCAR=0.0
141 1 my ($self) = @_;
142 1 require Twilio::Rest::Events::V1::Sink::SinkValidate;
143 return Twilio::Rest::Events::V1::Sink::SinkValidateList->new($self->{version},
144 1 $self->{solution}{sid});
145 }
146  
147 package Twilio::Rest::Events::V1::SinkInstance;
148  
149 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
150  
151 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
152  
153 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
154 4 my ($class, $version, $payload, $sid) = @_;
155 4 my $self = $class->SUPER::new($version, $payload);
156 4 ▶ $self->{solution} = { 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
157 4 return $self;
158 }
159  
160 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
161 0 my ($self, @arguments) = @_;
162 0 return $self->_context->delete(@arguments);
163 }
164  
165 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->fetch(@arguments);
168 }
169  
170 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
171 0 my ($self, @arguments) = @_;
172 0 return $self->_context->update(@arguments);
173 }
174  
175 0 ▶sub sink_test {
Subroutine sink_test: not called CC=1 SCAR=6.9
176 0 my ($self, @arguments) = @_;
177 0 return $self->_context->sink_test(@arguments);
178 }
179  
180 0 ▶sub sink_validate {
Subroutine sink_validate: not called CC=1 SCAR=6.9
181 0 my ($self, @arguments) = @_;
182 0 return $self->_context->sink_validate(@arguments);
183 }
184  
185 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
186 0 my ($self) = @_;
187 0 return Twilio::Rest::Events::V1::SinkContext->new($self->{version}, $self->{solution}{sid});
188 }
189  
190 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
191 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
192 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
193 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
194 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
195 4 ▶sub sink_configuration { return $_[0]{properties}{sink_configuration} }
Subroutine sink_configuration: called CC=1 SCAR=0.0
196 4 ▶sub sink_type { return $_[0]{properties}{sink_type} }
Subroutine sink_type: called CC=1 SCAR=0.0
197 4 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
198 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
199  
200 2 1;
201  
202 __END__
« Twilio/Rest/Api/V2010/Account/Call/Payment.pm ↑ Summary Twilio/Rest/Insights/V1/Call.pm »