Twilio/Rest/Verify/V2/Service/RateLimit/Bucket.pm

filter: Statementstmt 84.2% 80 / 95 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 81.5% 31 / 38 Podpod n/a totaltotal 79.8% 115 / 144 CC 4 SCAR 2.8
CC
4
Cov
82%
page
2.0
update
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Serverless/V1/Service/Environment/Variable.pm ↑ Summary Twilio/Rest/Chat/V1/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::RateLimit::Bucket;
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::RateLimit::BucketList;
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, $rate_limit_sid) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = { service_sid => $service_sid, rate_limit_sid => $rate_limit_sid };
19 5 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/RateLimits/', Twilio::Serialize::path_segment($rate_limit_sid), '/Buckets';
21 5 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
25 1 my ($self, $max, $interval) = @_;
26  
27 1 my $data = {
28 Max => $max,
29 Interval => $interval,
30 };
31  
32 my $response =
33 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
34 return Twilio::Rest::Verify::V2::Service::RateLimit::BucketInstance->new(
35 $self->{version}, $response->get_content,
36 $self->{solution}{service_sid},
37 $self->{solution}{rate_limit_sid}
38 1 );
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::RateLimit::BucketPage->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::RateLimit::BucketContext->new(
80 $self->{version},
81 $self->{solution}{service_sid},
82 3 $self->{solution}{rate_limit_sid}, $sid
83 );
84 }
85  
86 package Twilio::Rest::Verify::V2::Service::RateLimit::BucketPage;
87  
88 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 1 ▶sub records_key { return 'buckets' }
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::Verify::V2::Service::RateLimit::BucketInstance->new(
95 $self->{version}, $payload,
96 $self->{solution}{service_sid},
97 $self->{solution}{rate_limit_sid}
98 1 );
99 }
100  
101 package Twilio::Rest::Verify::V2::Service::RateLimit::BucketContext;
102  
103 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
108 3 my ($class, $version, $service_sid, $rate_limit_sid, $sid) = @_;
109 3 my $self = $class->SUPER::new($version);
110 $self->{solution} =
111 3 { service_sid => $service_sid, rate_limit_sid => $rate_limit_sid, sid => $sid };
112 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
113 '/RateLimits/', Twilio::Serialize::path_segment($rate_limit_sid), '/Buckets/',
114 Twilio::Serialize::path_segment($sid);
115 3 return $self;
116 }
117  
118 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
119 1 my ($self) = @_;
120 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
121 1 return 1;
122 }
123  
124 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
125 1 my ($self) = @_;
126  
127 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
128 1 return $self->_build_instance($response);
129 }
130  
131 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
132 1 my ($self, $options) = @_;
133 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
134  
135 my $data = {
136 Interval => $options->{interval},
137 Max => $options->{max},
138 1 };
139  
140 my $response =
141 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
142 1 return $self->_build_instance($response);
143 }
144  
145 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
146 2 my ($self, $response) = @_;
147 return Twilio::Rest::Verify::V2::Service::RateLimit::BucketInstance->new(
148 $self->{version}, $response->get_content,
149 $self->{solution}{service_sid},
150 $self->{solution}{rate_limit_sid},
151 $self->{solution}{sid}
152 2 );
153 }
154  
155 package Twilio::Rest::Verify::V2::Service::RateLimit::BucketInstance;
156  
157 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
158  
159 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
160  
161 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
162 4 my ($class, $version, $payload, $service_sid, $rate_limit_sid, $sid) = @_;
163 4 my $self = $class->SUPER::new($version, $payload);
164 $self->{solution} = {
165 service_sid => $service_sid,
166 rate_limit_sid => $rate_limit_sid,
167 sid => $sid // $self->{properties}{sid}
168 4 ▶ };
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
169 4 return $self;
170 }
171  
172 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
173 0 my ($self, @arguments) = @_;
174 0 return $self->_context->delete(@arguments);
175 }
176  
177 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->fetch(@arguments);
180 }
181  
182 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->update(@arguments);
185 }
186  
187 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
188 0 my ($self) = @_;
189 return Twilio::Rest::Verify::V2::Service::RateLimit::BucketContext->new(
190 $self->{version},
191 $self->{solution}{service_sid},
192 $self->{solution}{rate_limit_sid},
193 $self->{solution}{sid}
194 0 );
195 }
196  
197 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
198 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
199 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
200 4 ▶sub interval { return $_[0]{properties}{interval} }
Subroutine interval: called CC=1 SCAR=0.0
201 4 ▶sub max { return $_[0]{properties}{max} }
Subroutine max: called CC=1 SCAR=0.0
202 4 ▶sub rate_limit_sid { return $_[0]{properties}{rate_limit_sid} }
Subroutine rate_limit_sid: called CC=1 SCAR=0.0
203 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
204 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
205 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
206  
207 2 1;
208  
209 __END__
« Twilio/Rest/Serverless/V1/Service/Environment/Variable.pm ↑ Summary Twilio/Rest/Chat/V1/Service/Channel/Message.pm »