line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Google::Client::Role::Token; |
2
|
|
|
|
|
|
|
$Google::Client::Role::Token::VERSION = '0.005'; |
3
|
17
|
|
|
17
|
|
18456
|
use strict; |
|
17
|
|
|
|
|
22
|
|
|
17
|
|
|
|
|
408
|
|
4
|
17
|
|
|
17
|
|
57
|
use warnings; |
|
17
|
|
|
|
|
20
|
|
|
17
|
|
|
|
|
320
|
|
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
51
|
use Moo::Role; |
|
17
|
|
|
|
|
16
|
|
|
17
|
|
|
|
|
92
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has cache => (is => 'ro', required => 1); |
9
|
|
|
|
|
|
|
has cache_key => (is => 'rw', writer => 'set_cache_key'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has access_token => (is => 'rw'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
around access_token => sub { |
14
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
15
|
|
|
|
|
|
|
return undef unless $self->cache_key; |
16
|
|
|
|
|
|
|
return $self->cache->get($self->cache_key); |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Google::Client::Role::Token |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
A role that provides access token attrs/methods for Google::Client::* modules. Will get the |
26
|
|
|
|
|
|
|
access_token value keyed by C<< $self->cache_key >> from the cache. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 access_token |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The access token retrieved from making an access token request to Google. Should only be used to get the value, |
33
|
|
|
|
|
|
|
as its value will be retrieved from the cache. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 cache |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The object which stores the access token. Can be a L instance, or any object |
38
|
|
|
|
|
|
|
which provides a C<< get($key) >> method. Used to retrieve the access token. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 cache_key |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
The key from which to get the access token from the cache. Should be set before making requests to Googles API |
43
|
|
|
|
|
|
|
as that's when we retrieve an access token. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Ali Zia, C<< >> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 REPOSITORY |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
L |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This is free software. You may use it and distribute it under the same terms as Perl itself. |
56
|
|
|
|
|
|
|
Copyright (C) 2016 - Ali Zia |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |