File Coverage

blib/lib/Pithub/Repos/Collaborators.pm
Criterion Covered Total %
statement 21 21 100.0
branch 6 6 100.0
condition n/a
subroutine 6 6 100.0
pod 4 4 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Pithub::Repos::Collaborators;
2             our $AUTHORITY = 'cpan:PLU';
3             our $VERSION = '0.01039';
4             # ABSTRACT: Github v3 Repo Collaborators API
5              
6 15     15   92 use Moo;
  15         28  
  15         119  
7 15     15   4105 use Carp qw( croak );
  15         38  
  15         5313  
8             extends 'Pithub::Base';
9              
10              
11             sub add {
12 4     4 1 8222 my ( $self, %args ) = @_;
13 4 100       21 croak 'Missing key in parameters: collaborator' unless $args{collaborator};
14 3         27 $self->_validate_user_repo_args( \%args );
15             return $self->request(
16             method => 'PUT',
17 3         33 path => sprintf( '/repos/%s/%s/collaborators/%s', delete $args{user}, delete $args{repo}, delete $args{collaborator} ),
18             %args,
19             );
20             }
21              
22              
23             sub is_collaborator {
24 4     4 1 3609 my ( $self, %args ) = @_;
25 4 100       22 croak 'Missing key in parameters: collaborator' unless $args{collaborator};
26 3         17 $self->_validate_user_repo_args( \%args );
27             return $self->request(
28             method => 'GET',
29 3         28 path => sprintf( '/repos/%s/%s/collaborators/%s', delete $args{user}, delete $args{repo}, delete $args{collaborator} ),
30             %args,
31             );
32             }
33              
34              
35             sub list {
36 19     19 1 2209 my ( $self, %args ) = @_;
37 19         64 $self->_validate_user_repo_args( \%args );
38             return $self->request(
39             method => 'GET',
40 13         80 path => sprintf( '/repos/%s/%s/collaborators', delete $args{user}, delete $args{repo} ),
41             %args,
42             );
43             }
44              
45              
46             sub remove {
47 4     4 1 3572 my ( $self, %args ) = @_;
48 4 100       24 croak 'Missing key in parameters: collaborator' unless $args{collaborator};
49 3         14 $self->_validate_user_repo_args( \%args );
50             return $self->request(
51             method => 'DELETE',
52 3         27 path => sprintf( '/repos/%s/%s/collaborators/%s', delete $args{user}, delete $args{repo}, delete $args{collaborator} ),
53             %args
54             );
55             }
56              
57             1;
58              
59             __END__