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

filter: Statementstmt 83.3% 85 / 102 Branchbran 100% 2 / 2 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.0% 32 / 40 Podpod n/a totaltotal 78.4% 124 / 158 CC 6 SCAR 3.4
CC
6
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Api/V2010/Account/Queue.pm ↑ Summary Twilio/Rest/Conversations/V1/Service/User.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;
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::RateLimitList;
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 10 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 10 my ($class, $version, $service_sid) = @_;
17 10 my $self = $class->SUPER::new($version);
18 10 $self->{solution} = { service_sid => $service_sid };
19 10 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/RateLimits';
21 10 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $unique_name, $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 UniqueName => $unique_name,
30 Description => $options->{description},
31 1 };
32  
33 my $response =
34 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Verify::V2::Service::RateLimitInstance->new($self->{version},
36 1 $response->get_content, $self->{solution}{service_sid});
37 }
38  
39 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->read_records(@arguments);
42 }
43  
44 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
45 0 my ($self, @arguments) = @_;
46 0 return $self->stream_records(@arguments);
47 }
48  
49 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
50 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
51 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
52  
53 1 my $params = {
54 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 return Twilio::Rest::Verify::V2::Service::RateLimitPage->new($self->{version}, $response,
72 1 $self->{solution});
73 }
74  
75 8 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
76 8 my ($self, $sid) = @_;
77 return Twilio::Rest::Verify::V2::Service::RateLimitContext->new($self->{version},
78 8 $self->{solution}{service_sid}, $sid);
79 }
80  
81 package Twilio::Rest::Verify::V2::Service::RateLimitPage;
82  
83 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 1 ▶sub records_key { return 'rate_limits' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 1 my ($self, $payload) = @_;
89 return Twilio::Rest::Verify::V2::Service::RateLimitInstance->new($self->{version}, $payload,
90 1 $self->{solution}{service_sid});
91 }
92  
93 package Twilio::Rest::Verify::V2::Service::RateLimitContext;
94  
95 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
100 8 my ($class, $version, $service_sid, $sid) = @_;
101 8 my $self = $class->SUPER::new($version);
102 8 $self->{solution} = { service_sid => $service_sid, sid => $sid };
103 8 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
104 '/RateLimits/', Twilio::Serialize::path_segment($sid);
105 8 return $self;
106 }
107  
108 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
109 1 my ($self) = @_;
110 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
111 1 return 1;
112 }
113  
114 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
115 1 my ($self) = @_;
116  
117 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
118 1 return $self->_build_instance($response);
119 }
120  
121 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
122 1 my ($self, $options) = @_;
123 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
124  
125 1 my $data = { Description => $options->{description}, };
126  
127 my $response =
128 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
129 1 return $self->_build_instance($response);
130 }
131  
132 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
133 2 my ($self, $response) = @_;
134 return Twilio::Rest::Verify::V2::Service::RateLimitInstance->new(
135 $self->{version}, $response->get_content,
136 $self->{solution}{service_sid}, $self->{solution}{sid}
137 2 );
138 }
139  
140 5 ▶sub buckets {
Subroutine buckets: called CC=2 SCAR=6.9
141 5 my ($self, $sid) = @_;
142 5 require Twilio::Rest::Verify::V2::Service::RateLimit::Bucket;
143 my $list = Twilio::Rest::Verify::V2::Service::RateLimit::BucketList->new(
144 $self->{version},
145 $self->{solution}{service_sid},
146 $self->{solution}{sid}
147 5 );
148 5 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 3 2 5
149 }
150  
151 package Twilio::Rest::Verify::V2::Service::RateLimitInstance;
152  
153 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
154  
155 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
158 4 my ($class, $version, $payload, $service_sid, $sid) = @_;
159 4 my $self = $class->SUPER::new($version, $payload);
160 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
161 4 return $self;
162 }
163  
164 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
165 0 my ($self, @arguments) = @_;
166 0 return $self->_context->delete(@arguments);
167 }
168  
169 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
170 0 my ($self, @arguments) = @_;
171 0 return $self->_context->fetch(@arguments);
172 }
173  
174 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
175 0 my ($self, @arguments) = @_;
176 0 return $self->_context->update(@arguments);
177 }
178  
179 0 ▶sub buckets {
Subroutine buckets: not called CC=1 SCAR=6.9
180 0 my ($self, @arguments) = @_;
181 0 return $self->_context->buckets(@arguments);
182 }
183  
184 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
185 0 my ($self) = @_;
186 return Twilio::Rest::Verify::V2::Service::RateLimitContext->new(
187 $self->{version},
188 $self->{solution}{service_sid},
189 $self->{solution}{sid}
190 0 );
191 }
192  
193 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
194 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
195 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
196 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
197 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
198 4 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
199 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
200 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
201 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
202  
203 2 1;
204  
205 __END__
« Twilio/Rest/Api/V2010/Account/Queue.pm ↑ Summary Twilio/Rest/Conversations/V1/Service/User.pm »