File Coverage

blib/lib/WebService/Shutterstock/AuthedClient.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 4 4 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1             package WebService::Shutterstock::AuthedClient;
2             {
3             $WebService::Shutterstock::AuthedClient::VERSION = '0.006';
4             }
5              
6             # ABSTRACT: Role comprising a REST client with the necessary auth token information
7              
8 10     10   71 use strict;
  10         16  
  10         2828  
9 10     10   60 use warnings;
  10         20  
  10         352  
10 10     10   62 use Moo::Role;
  10         23  
  10         84  
11              
12 10     10   3417 use WebService::Shutterstock::HasClient;
  10         21  
  10         2544  
13             with 'WebService::Shutterstock::HasClient';
14              
15              
16             has auth_info => ( is => 'ro', required => 1 );
17              
18              
19              
20 17     17 1 194 sub auth_token { return shift->auth_info->{auth_token} }
21 11     11 1 200 sub username { return shift->auth_info->{username} }
22              
23              
24             sub new_with_auth {
25 8     8 1 18 my $self = shift;
26 8         17 my $class = shift;
27 8         57 return $self->new_with_client( $class, @_, auth_info => $self->auth_info );
28             }
29              
30              
31             sub with_auth_params {
32 15     15 1 36 my $self = shift;
33 15         239 my %other = @_;
34 15         67 return { %other, auth_token => $self->auth_token };
35             }
36              
37             1;
38              
39             __END__