File Coverage

blib/lib/WWW/JSON/Role/Authentication/OAuth2.pm
Criterion Covered Total %
statement 6 10 60.0
branch 0 2 0.0
condition n/a
subroutine 2 4 50.0
pod n/a
total 8 16 50.0


line stmt bran cond sub pod time code
1             package WWW::JSON::Role::Authentication::OAuth2;
2 8     8   4694 use Moo::Role;
  8         15  
  8         45  
3 8     8   2417 use Safe::Isa;
  8         13  
  8         2140  
4             requires 'authentication';
5             requires 'ua';
6              
7             sub _validate_OAuth2 {
8 0     0     my ( $self, $auth ) = @_;
9 0 0         die "Must pass a Net::OAuth2::AccessToken object when using "
10             . __PACKAGE__
11             . " authentication."
12             unless $auth->$_isa('Net::OAuth2::AccessToken');
13             }
14              
15             sub _auth_OAuth2 {
16 0     0     my ( $self, $auth, $req ) = @_;
17 0           $req->header( Authorization => 'Bearer ' . $auth->access_token );
18             }
19              
20             1;