CatalystX/OAuth2/Client.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 80.7% 21 / 26 SCAR 7.0
CC
2
Cov
89%
ua
2.5
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« CatalystX/OAuth2/Request/AuthToken.pm ↑ Summary Catalyst/ActionRole/OAuth2/GrantAuth.pm »
1 package CatalystX::OAuth2::Client;
2 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: An http client for requesting oauth2-protected resources using a token
6  
7 4 our $UA;
8  
9 4 has token => ( isa => 'Str', is => 'rw', required => 1 );
10  
11 1 ▶sub ua { $UA ||= LWP::UserAgent->new };
Subroutine ua: called CC=2 SCAR=9.2
Pod undocumented
Condition33%1/3
$CatalystX::OAuth2::Client::UA ||= "LWP::UserAgent"->new
l!l&&r!l&&!r
100
MC/DC0%0/2
$CatalystX::OAuth2::Client::UA ||= "LWP::UserAgent"->new
$CatalystX::OAuth2::Client::UA "LWP::UserAgent"->new
Truth table33%1/3
A ||= B
A= $CatalystX::OAuth2::Client::UAB= "LWP::UserAgent"->new
ABresult
1X1
011
000
12 1 ▶sub request { shift->ua->request(@_) }
Subroutine request: called CC=1 SCAR=0.0
13  
14 before request => sub {
15 1 ▶ my($self, $req) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
16 1 my $token = $self->token;
17 1 $req->header( Authorization => 'Bearer ' . $token );
18 4 };
19  
20 4 1;
21  
22 __END__
23  
24 =pod
25  
26 =head1 NAME
27  
28 CatalystX::OAuth2::Client - An http client for requesting oauth2-protected resources using a token
29  
30 =head1 VERSION
31  
32 version 0.001006
33  
34 =head1 AUTHOR
35  
36 Eden Cardim <edencardim@gmail.com>
37  
38 =head1 COPYRIGHT AND LICENSE
39  
40 This software is copyright (c) 2017 by Suretec Systems Ltd.
41  
42 This is free software; you can redistribute it and/or modify it under
43 the same terms as the Perl 5 programming language system itself.
44  
45 =cut
« CatalystX/OAuth2/Request/AuthToken.pm ↑ Summary Catalyst/ActionRole/OAuth2/GrantAuth.pm »