line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bintray::API::Subject; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
####################### |
4
|
|
|
|
|
|
|
# LOAD CORE MODULES |
5
|
|
|
|
|
|
|
####################### |
6
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
60
|
|
7
|
1
|
|
|
1
|
|
7
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
73
|
|
8
|
1
|
|
|
1
|
|
6
|
use Carp qw(croak carp); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
117
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
####################### |
11
|
|
|
|
|
|
|
# VERSION |
12
|
|
|
|
|
|
|
####################### |
13
|
|
|
|
|
|
|
our $VERSION = '1.0.2'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
####################### |
16
|
|
|
|
|
|
|
# LOAD CPAN MODULES |
17
|
|
|
|
|
|
|
####################### |
18
|
1
|
|
|
1
|
|
6
|
use Params::Validate qw(validate_with :types); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
255
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
7
|
use Object::Tiny qw( |
21
|
|
|
|
|
|
|
name |
22
|
|
|
|
|
|
|
session |
23
|
1
|
|
|
1
|
|
7
|
); |
|
1
|
|
|
|
|
2
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
####################### |
26
|
|
|
|
|
|
|
# LOAD DIST MODULES |
27
|
|
|
|
|
|
|
####################### |
28
|
1
|
|
|
1
|
|
699
|
use Bintray::API::Repo; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
12
|
|
29
|
1
|
|
|
1
|
|
41
|
use Bintray::API::Session; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
####################### |
32
|
|
|
|
|
|
|
# PUBLIC METHODS |
33
|
|
|
|
|
|
|
####################### |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
## Constructor |
36
|
|
|
|
|
|
|
sub new { |
37
|
0
|
|
|
0
|
0
|
|
my ( $class, @args ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my %opts = validate_with( |
40
|
|
|
|
|
|
|
params => [@args], |
41
|
|
|
|
|
|
|
spec => { |
42
|
|
|
|
|
|
|
session => { |
43
|
|
|
|
|
|
|
type => OBJECT, |
44
|
|
|
|
|
|
|
isa => 'Bintray::API::Session', |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
name => { |
47
|
|
|
|
|
|
|
type => SCALAR, |
48
|
|
|
|
|
|
|
default => '', |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
); |
52
|
0
|
|
0
|
|
|
|
$opts{name} ||= $opts{session}->username() |
|
|
|
0
|
|
|
|
|
53
|
|
|
|
|
|
|
|| croak "Subject Name is required"; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $class->SUPER::new(%opts); |
56
|
|
|
|
|
|
|
} ## end sub new |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Repository Object |
59
|
|
|
|
|
|
|
sub repo { |
60
|
0
|
|
|
0
|
0
|
|
my ( $self, @args ) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my %opts = validate_with( |
63
|
|
|
|
|
|
|
params => [@args], |
64
|
|
|
|
|
|
|
spec => { |
65
|
|
|
|
|
|
|
name => { |
66
|
|
|
|
|
|
|
type => SCALAR, |
67
|
|
|
|
|
|
|
}, |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return Bintray::API::Repo->new( |
72
|
|
|
|
|
|
|
session => $self->session(), |
73
|
|
|
|
|
|
|
subject => $self, |
74
|
|
|
|
|
|
|
name => $opts{name}, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} ## end sub repo |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
####################### |
79
|
|
|
|
|
|
|
# API METHODS |
80
|
|
|
|
|
|
|
####################### |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
## Info |
83
|
|
|
|
|
|
|
sub info { |
84
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
85
|
0
|
|
|
|
|
|
return $self->session->talk( |
86
|
|
|
|
|
|
|
path => join( '/', 'users', $self->name, ), |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
} ## end sub info |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
## Followers |
91
|
|
|
|
|
|
|
sub followers { |
92
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
93
|
0
|
|
|
|
|
|
return $self->session->paginate( |
94
|
|
|
|
|
|
|
path => join( '/', 'users', $self->name, 'followers', ), |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
} ## end sub followers |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
## Repositories |
99
|
|
|
|
|
|
|
sub repos { |
100
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return $self->session()->talk( |
103
|
|
|
|
|
|
|
path => join( '/', 'repos', $self->name() ), |
104
|
|
|
|
|
|
|
anon => 1, |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
} ## end sub repos |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
## Get Webhooks |
109
|
|
|
|
|
|
|
sub get_webhooks { |
110
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
111
|
0
|
|
|
|
|
|
return $self->session->talk( |
112
|
|
|
|
|
|
|
path => join( '/', 'webhooks', $self->name() ), |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
} ## end sub get_webhooks |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
####################### |
117
|
|
|
|
|
|
|
# API HELPERS |
118
|
|
|
|
|
|
|
####################### |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# Repository names |
121
|
|
|
|
|
|
|
sub repo_names { |
122
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
123
|
0
|
0
|
|
|
|
|
my $resp = $self->repos() or return; |
124
|
0
|
|
|
|
|
|
my @repos = map { $_->{name} } @{$resp}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
return @repos; |
126
|
|
|
|
|
|
|
} ## end sub repo_names |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
####################### |
129
|
|
|
|
|
|
|
1; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__END__ |