line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
414
|
use 5.006; # our |
|
1
|
|
|
|
|
2
|
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Net::Travis::API::Auth::GitHub; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.002001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Authorize with Travis using a GitHub token |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
477
|
use Moo qw( with ); |
|
1
|
|
|
|
|
9344
|
|
|
1
|
|
|
|
|
4
|
|
14
|
1
|
|
|
1
|
|
1004
|
use Scalar::Util qw(blessed); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
212
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'Net::Travis::API::Role::Client'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _get_token_for { |
32
|
0
|
|
|
0
|
|
|
my ( $self, $gh_token ) = @_; |
33
|
0
|
|
|
|
|
|
return $self->http_engine->post_form( '/auth/github', { github_token => $gh_token } ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_token_for { |
45
|
0
|
|
|
0
|
1
|
|
my ( $self, $gh_token ) = @_; |
46
|
0
|
0
|
|
|
|
|
if ( not blessed $self ) { |
47
|
0
|
|
|
|
|
|
$self = $self->new(); |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
my $result = $self->_get_token_for($gh_token); |
50
|
0
|
0
|
|
|
|
|
return if not '200' eq $result->status; |
51
|
0
|
0
|
|
|
|
|
return if not length $result->content; |
52
|
0
|
0
|
|
|
|
|
return unless my $json = $result->content_json; |
53
|
0
|
|
|
|
|
|
return $json->{access_token}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub get_authorised_ua_for { |
68
|
0
|
|
|
0
|
1
|
|
my ( $self, $gh_token ) = @_; |
69
|
0
|
0
|
|
|
|
|
$self = $self->new() if not blessed $self; |
70
|
0
|
|
|
|
|
|
my $token = $self->get_token_for($gh_token); |
71
|
0
|
|
|
|
|
|
$self->http_engine->authtokens( [$token] ); |
72
|
0
|
|
|
|
|
|
return $self->http_engine; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
4
|
no Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |