OAuth2/ServiceProvider/Line/AccessToken.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 33.3% 1 / 3 totaltotal 93.3% 28 / 30 CC 2 SCAR 2.5
CC
2
Cov
100%
should_refresh
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« OAuth2/ServiceProvider/Line.pm ↑ Summary OAuth2/ServiceProvider/Withings.pm »
1 package LWP::Authen::OAuth2::ServiceProvider::Line::AccessToken;
2  
3 # ABSTRACT: Line AccessToken
4 2 our $VERSION = '0.20'; # VERSION
5  
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use parent 'LWP::Authen::OAuth2::AccessToken::Bearer';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $REFRESH_PERIOD = 864000; # 10 days. https://devdocs.line.me/en/#refreshing-access-tokens
11  
12 # Line tokens can be refreshed until the refresh period is over.
13 4 ▶sub should_refresh {
Subroutine should_refresh: called CC=2 SCAR=6.9
Pod documented
14 4 my ($self, @args) = @_;
15  
16 4 ▶ return 0 unless $self->SUPER::should_refresh(@args);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->SUPER::should_refresh(@args) 1 3 4
17  
18 3 my $refresh_expires_time = $self->expires_time + $REFRESH_PERIOD;
19 3 my $refresh_token_valid = time < $refresh_expires_time;
20  
21 3 return $refresh_token_valid;
22 }
23  
24 # These are exposed for use with /oauth/verify and /oauth/revoke API requests
25 1 ▶sub access_token { shift->{access_token} }
Subroutine access_token: called CC=1 SCAR=0.0
Pod undocumented
26 1 ▶sub refresh_token { shift->{refresh_token} }
Subroutine refresh_token: called CC=1 SCAR=0.0
Pod undocumented
27  
28 2 1;
29  
30 __END__
« OAuth2/ServiceProvider/Line.pm ↑ Summary OAuth2/ServiceProvider/Withings.pm »