File Coverage

blib/lib/Net/GitHub/V3/Orgs.pm
Criterion Covered Total %
statement 9 26 34.6
branch 0 10 0.0
condition n/a
subroutine 3 8 37.5
pod 1 5 20.0
total 13 49 26.5


line stmt bran cond sub pod time code
1             package Net::GitHub::V3::Orgs;
2              
3 1     1   7 use Moo;
  1         2  
  1         7  
4              
5             our $VERSION = '0.60';
6             our $AUTHORITY = 'cpan:FAYLAND';
7              
8 1     1   347 use URI::Escape;
  1         3  
  1         599  
9              
10             with 'Net::GitHub::V3::Query';
11              
12             sub orgs {
13 0     0 1   my ( $self, $user ) = @_;
14              
15 0 0         my $u = $user ? "/users/" . uri_escape($user) . '/orgs' : '/user/orgs';
16 0           return $self->query($u);
17             }
18              
19             sub next_org {
20 0     0 0   my ( $self, $user ) = @_;
21              
22 0 0         my $u = $user ? "/users/" . uri_escape($user) . '/orgs' : '/user/orgs';
23 0           return $self->next($u);
24             }
25              
26             sub close_org {
27 0     0 0   my ( $self, $user ) = @_;
28              
29 0 0         my $u = $user ? "/users/" . uri_escape($user) . '/orgs' : '/user/orgs';
30 0           return $self->close($u);
31             }
32              
33             sub next_repos {
34 0     0 0   my ( $self, $org ) = @_;
35              
36 0 0         die "missing org" unless defined $org;
37 0           my $u = sprintf( "/orgs/%s/repos", uri_escape($org) );
38 0           return $self->next($u);
39             }
40              
41             sub close_repos {
42 0     0 0   my ( $self, $org ) = @_;
43              
44 0 0         die "missing org" unless defined $org;
45 0           my $u = sprintf( "/orgs/%s/repos", uri_escape($org) );
46              
47 0           return $self->close($u);
48             }
49              
50             ## build methods on fly
51             my %__methods = (
52             ### ------------------------------------------------
53             ### /orgs
54             ### ------------------------------------------------
55             org => { url => "/orgs/%s" },
56             update_org => { url => "/orgs/%s", method => 'PATCH', args => 1 },
57             # Members
58             members => { url => "/orgs/%s/members", paginate => 1 },
59             owner_members => { url => "/orgs/%s/members?role=admin", paginate => 1 },
60             no_2fa_members => { url => "/orgs/%s/members?filter=2fa_disabled", paginate => 1 },
61             outside_collaborators => { url => "/orgs/%s/outside_collaborators", paginate => 1 },
62             is_member => { url => "/orgs/%s/members/%s", check_status => 204 },
63             delete_member => { url => "/orgs/%s/members/%s", method => 'DELETE', check_status => 204 },
64             public_members => { url => "/orgs/%s/public_members", paginate => 1 },
65             is_public_member => { url => "/orgs/%s/public_members/%s", check_status => 204 },
66             publicize_member => { url => "/orgs/%s/public_members/%s", method => 'PUT', check_status => 204 },
67             conceal_member => { url => "/orgs/%s/public_members/%s", method => 'DELETE', check_status => 204 },
68             membership => { url => "/orgs/:org/memberships/:username", method => 'GET', v => 2 },
69             update_membership => { url => "/orgs/:org/memberships/:username", method => 'PUT', args => 1, v => 2 },
70             delete_membership => { url => "/orgs/:org/memberships/:username", method => 'DELETE', check_status => 204, v => 2 },
71              
72             # List all repositories for an organisation
73             repos => { url => "/orgs/:org/repos", paginate => 1, v => 2 },
74              
75             # Org Teams API
76             teams => { url => "/orgs/%s/teams", paginate => 1 },
77              
78             ### ------------------------------------------------
79             ### /teams
80             ### ------------------------------------------------
81              
82             team => { url => "/teams/%s" },
83             create_team => { url => "/orgs/%s/teams", method => 'POST', args => 1 },
84             update_team => { url => "/teams/%s", method => 'PATCH', args => 1 },
85             delete_team => { url => "/teams/%s", method => 'DELETE', check_status => 204 },
86             team_members => { url => "/teams/%s/members", paginate => 1 },
87             is_team_member => { url => "/teams/%s/members/%s", check_status => 204 },
88             add_team_member => { url => "/teams/%s/members/%s", method => 'PUT', check_status => 204 },
89             delete_team_member => { url => "/teams/%s/members/%s", method => 'DELETE', check_status => 204 },
90             team_maintainers => { url => "/teams/%s/members?role=maintainer", paginate => 1 },
91             team_repos => { url => "/teams/%s/repos", paginate => 1 },
92             is_team_repos => { url => "/teams/%s/repos/%s", check_status => 204 },
93             add_team_repos => { url => "/teams/%s/repos/%s", method => 'PUT', args => 1, check_status => 204 },
94             delete_team_repos => { url => "/teams/%s/repos/%s", method => 'DELETE', check_status => 204 },
95             );
96              
97             __build_methods(__PACKAGE__, %__methods);
98              
99 1     1   32 no Moo;
  1         4  
  1         5  
100              
101             1;
102             __END__