lib/Finance/Dogechain/Base.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 1 / 1 totaltotal 53.1% 17 / 32 SCAR 13.9
CC
3
Cov
52%
return_field_if_success
12.0
__ANON__
1.1
__ANON__
1.1
CRAP 4.0
« lib/Finance/Dogechain/Block.pm ↑ Summary blib/lib/Finance/Dogechain.pm »
1 package Finance::Dogechain::Base;
2 1 $Finance::Dogechain::Base::VERSION = '1.20210418.2306';
3 1 ▶use Mojo::Base -base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Net::SSLeay;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶has 'ua' => sub { Mojo::UserAgent->new->max_redirects(3) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
8 0 ▶has 'base_url' => sub { 'https://dogechain.info/api/v1' };
Subroutine __ANON__: not called CC=1 SCAR=1.2
9  
10 ▶sub return_field_if_success($self, $url_path, $field) {
Subroutine return_field_if_success: not called CC=3 SCAR=24.8
Pod documented
11 0 my $res = $self->ua->get( $self->base_url . $url_path )->result;
12  
13 0 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 0 0 0
14 0 my $json = $res->json;
15 0 ▶ return $json->{$field} if $json->{success};
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"success"} 0 0 0
16 0 return 0;
17 }
18  
19 0 return;
20 }
21  
22 1 'to the moon';
23 __END__
« lib/Finance/Dogechain/Block.pm ↑ Summary blib/lib/Finance/Dogechain.pm »