line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Google::Code::Issue::Base; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
7291
|
use Any::Moose; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
70
|
|
4
|
9
|
|
|
9
|
|
5529
|
use LWP::UserAgent; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
559
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has 'project' => ( |
7
|
|
|
|
|
|
|
isa => 'Str', |
8
|
|
|
|
|
|
|
is => 'rw', |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'token' => ( |
12
|
|
|
|
|
|
|
isa => 'Str', |
13
|
|
|
|
|
|
|
is => 'rw', |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
9
|
|
64
|
no Any::Moose; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
42
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub feeds_issues_url { |
20
|
3
|
|
|
3
|
1
|
6
|
my $self = shift; |
21
|
|
|
|
|
|
|
return |
22
|
3
|
|
|
|
|
38
|
'http://code.google.com/feeds/issues/p/' |
23
|
|
|
|
|
|
|
. $self->project |
24
|
|
|
|
|
|
|
. '/issues'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub ua { |
28
|
3
|
|
|
3
|
1
|
11
|
my $self = shift; |
29
|
3
|
|
|
|
|
7
|
my $skip_auth = shift; |
30
|
3
|
|
|
|
|
1736
|
require Net::Google::Code; |
31
|
3
|
|
|
|
|
35
|
my $ua = LWP::UserAgent->new( agent => 'net-google-code-issue/' |
32
|
|
|
|
|
|
|
. $Net::Google::Code::VERSION ); |
33
|
3
|
50
|
|
|
|
25
|
return $ua if $skip_auth; |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
42
|
$ua->default_header( 'Content-Type' => 'application/atom+xml' ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# get auth token |
38
|
3
|
0
|
33
|
|
|
279
|
if ( $self->email && $self->password && !$self->token ) { |
|
|
|
33
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
$self->get_token(); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
3
|
50
|
|
|
|
30
|
$ua->default_header( Authorization => 'GoogleLogin auth=' . $self->token ) |
43
|
|
|
|
|
|
|
if $self->token; |
44
|
3
|
|
|
|
|
14
|
return $ua; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub get_token { |
48
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
my $ua = $self->ua(1); # don't need auth |
50
|
0
|
|
|
|
|
|
my $response = $ua->post( |
51
|
|
|
|
|
|
|
'https://www.google.com/accounts/ClientLogin', |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
Email => $self->email, |
54
|
|
|
|
|
|
|
Passwd => $self->password, |
55
|
|
|
|
|
|
|
service => 'code', |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
); |
58
|
0
|
0
|
0
|
|
|
|
if ( $response->is_success && $response->content =~ /Auth=(\S+)/ ) { |
59
|
0
|
|
|
|
|
|
$self->token($1); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
0
|
|
|
|
|
|
warn "failed to get auth token: " |
63
|
|
|
|
|
|
|
. $response->status_line . "\n" |
64
|
|
|
|
|
|
|
. $response->content; |
65
|
0
|
|
|
|
|
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |