Branch Coverage

blib/lib/Tesla/API.pm
Criterion Covered Total %
branch 52 100 52.0


line true false branch
65 19 0 if ($params{'unauthenticated'})
84 1 1 unless (defined $endpoint_name)
94 1 0 if ($uri =~ /\{/)
95 1 0 unless (defined $id and $id =~ /^\d+$/)
103 0 0 if ($self->api_cache_persist or $self->api_cache_time)
105 0 0 if ($cache)
106 0 0 if ($self->api_cache_persist or time - $cache->{'time'} <= $self->api_cache_time)
117 0 0 if ($auth)
146 1 1 if (defined $persist)
153 8 1 if (defined $cache_seconds)
154 5 3 unless ($cache_seconds =~ /^\d+$/)
164 19 2 if (not $self->{'endpoints'} or $self->{'reset_data'})
170 0 19 unless open my $fh, "<", "/root/.cpan/build/Tesla-API-1.00-0/blib/lib/auto/share/dist/Tesla-API/endpoints.json"
179 1 20 if ($endpoint)
180 0 1 unless (exists $self->{'endpoints'}{$endpoint})
191 0 1 if $self->{'mech'}
207 1 579 unless ($self->{'option_codes'})
211 0 1 unless open my $fh, "<", "/root/.cpan/build/Tesla-API-1.00-0/blib/lib/auto/share/dist/Tesla-API/option_codes.json"
221 579 1 if ($code)
222 1 578 unless (exists $self->{'option_codes'}{$code})
236 0 0 if ($data_url =~ m[.*/(\w+\.json)$])
240 0 0 unless (defined $filename)
256 0 0 if (scalar keys %$new_data != scalar keys %$existing_data)
260 0 0 unless ($data_differs)
262 0 0 unless (exists $existing_data->{$key})
268 0 0 unless (exists $new_data->{$key})
275 0 0 if ($data_differs)
282 0 0 unless copy($file, $backup)
286 0 0 unless open my $fh, ">", "$file"
296 1 2 if (defined $ua_string)
305 14 2 if (defined $timeout)
306 9 5 unless ($timeout =~ /^\d+?(?:\.\d+)?$/)
323 0 0 unless (-e $self->_authentication_cache_file)
327 0 0 unless ($self->_access_token_valid)
340 3 6 if defined $data
342 7 2 if $self->{'cache_data'}
346 1 1 unless open my $fh, "<", $self->_authentication_cache_file
400 1 1 if (time + 5 < $token_expires_at)
412 0 5 if (not defined $token_data or ref $token_data ne "HASH")
464 0 2 if (not defined $token_data or ref $token_data ne "HASH")
470 0 2 unless open my $fh, ">", $self->_authentication_cache_file
479 0 0 if (defined $add)
493 1 5 unless ($endpoint)
497 3 2 if ($data)
511 4 7 if (defined $filename)
525 1 0 if $self->{'authentication_code'}
550 1 0 if ($code_url =~ /code=(.*?)\&/) { }
591 2 3 if (defined $self->{'authentication_code_verifier'})
628 0 0 if ($response->is_success)
633 0 0 unless ($response->is_success)