| 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
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
| |||||||||||||||||||||
| 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 | ||||||||||||||||||||