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