examples/HTTP/API/Core/Example/Cloudflare.pm

filter: Statementstmt 100% 23 / 23 Branchbran 50.0% 1 / 2 Conditioncond 45.4% 5 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 72.0% 36 / 50 CC 8 SCAR 11.4
CC
8
Cov
81%
__ANON__
4.6
new
3.3
zones_pager
3.1
CRAP 3.1
« examples/HTTP/API/Core/Example/TransportAdapters.pm ↑ Summary examples/HTTP/API/Core/Example/Stripe.pm »
1 package HTTP::API::Core::Example::Cloudflare;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use parent 'HTTP::API::Core';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub new {
Subroutine new: called CC=3 SCAR=12.0
Pod documented
8 1 my ($class, %args) = @_;
9 1 my $token = delete $args{token};
10 1 ▶ die "token is required\n" if !defined($token) || $token eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $token or $token eq "" 0 1 1
Condition33%1/3
not defined $token or $token eq ""
l!l&&r!l&&!r
001
MC/DC0%0/2
not defined $token or $token eq ""
not defined $token $token eq ""
Truth table33%1/3
not(A) or B
A= not defined $tokenB= $token eq ""
ABresult
1X1
011
000
11  
12 1 return $class->SUPER::new(
13 base_url => 'https://api.cloudflare.com/client/v4',
14 headers => { Authorization => "Bearer $token" },
15 %args,
16 );
17 }
18  
19 1 ▶sub zones_pager {
Subroutine zones_pager: called CC=3 SCAR=11.4
Pod undocumented
20 1 my ($self, %args) = @_;
21 1 ▶ my $per_page = delete($args{per_page}) || 50;
Condition50%1/2
delete $args{'per_page'} || 50
l!l
10
MC/DC0%0/1
delete $args{'per_page'} || 50
delete $args{'per_page'}
Truth table50%1/2
A
A= delete $args{'per_page'}
Aresult
11
00
22 1 my $name = delete $args{name};
23 1 my $status = delete $args{status};
24 1 die "unknown zones option: $_\n" for sort keys %args;
25  
26 return $self->paginate(
27 '/zones',
28 mode => 'page',
29 items => 'result',
30 2 ▶ has_more => sub {
Subroutine __ANON__: called CC=4 SCAR=15.2
31 2 my ($data) = @_;
32 2 ▶ my $info = $data->{result_info} || {};
Condition50%1/2
$data->{'result_info'} || {}
l!l
20
MC/DC0%0/1
$data->{'result_info'} || {}
$data->{'result_info'}
Truth table50%1/2
A
A= $data->{'result_info'}
Aresult
11
00
33 2 ▶ return ($info->{page} || 0) < ($info->{total_pages} || 0);
Condition50%2/4
$info->{'page'} || 0
l!l
20
$info->{'total_pages'} || 0
l!l
20
MC/DC0%0/1
$info->{'page'} || 0
$info->{'page'}
MC/DC0%0/1
$info->{'total_pages'} || 0
$info->{'total_pages'}
Truth table50%1/2
A
A= $info->{'page'}
Aresult
11
00
Truth table50%1/2
A
A= $info->{'total_pages'}
Aresult
11
00
34 },
35 1 page_size => $per_page,
36 page_param => 'page',
37 page_size_param => 'per_page',
38 query => {
39 name => $name,
40 status => $status,
41 },
42 );
43 }
44  
45 1 1;
« examples/HTTP/API/Core/Example/TransportAdapters.pm ↑ Summary examples/HTTP/API/Core/Example/Stripe.pm »