blib/lib/Finance/Dogechain/Base.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 SCAR 24.8
CC
3
Cov
0%
return_field_if_success
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 package Finance::Dogechain::Base;
2 $Finance::Dogechain::Base::VERSION = '1.20210418.2306';
3 use Mojo::Base -base, -signatures;
4 use Mojo::UserAgent;
5 use Net::SSLeay;
6  
7 has 'ua' => sub { Mojo::UserAgent->new->max_redirects(3) };
8 has 'base_url' => sub { 'https://dogechain.info/api/v1' };
9  
10 sub return_field_if_success($self, $url_path, $field) {
11 my $res = $self->ua->get( $self->base_url . $url_path )->result;
12  
13 if ($res->is_success) {
14 my $json = $res->json;
15 return $json->{$field} if $json->{success};
16 return 0;
17 }
18  
19 return;
20 }
21  
22 'to the moon';
23 __END__