Pithub/Repos/Collaborators.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 4 / 4 totaltotal 100% 41 / 41 CC 4 SCAR 5.1
CC
4
Cov
100%
add
2.0
is_collaborator
2.0
remove
2.0
CRAP 1.7
« Pithub/Issues/Events.pm ↑ Summary Pithub/Repos/Keys.pm »
1 package Pithub::Repos::Collaborators;
2 16 our $AUTHORITY = 'cpan:PLU';
3 16 our $VERSION = '0.01041';
4  
5 # ABSTRACT: Github v3 Repo Collaborators API
6  
7 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 extends 'Pithub::Base';
10  
11  
12 sub add {
13 4 ▶ my ( $self, %args ) = @_;
Subroutine add: called CC=2 SCAR=6.9
Pod documented
14 croak 'Missing key in parameters: collaborator'
15 4 ▶ unless $args{collaborator};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"collaborator"} 1 3 4
16 3 $self->_validate_user_repo_args( \%args );
17 return $self->request(
18 method => 'PUT',
19 path => sprintf(
20 '/repos/%s/%s/collaborators/%s', delete $args{user},
21 delete $args{repo}, delete $args{collaborator}
22 3 ),
23 %args,
24 );
25 }
26  
27  
28 sub is_collaborator {
29 4 ▶ my ( $self, %args ) = @_;
Subroutine is_collaborator: called CC=2 SCAR=6.9
Pod documented
30 croak 'Missing key in parameters: collaborator'
31 4 ▶ unless $args{collaborator};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"collaborator"} 1 3 4
32 3 $self->_validate_user_repo_args( \%args );
33 return $self->request(
34 method => 'GET',
35 path => sprintf(
36 '/repos/%s/%s/collaborators/%s', delete $args{user},
37 delete $args{repo}, delete $args{collaborator}
38 3 ),
39 %args,
40 );
41 }
42  
43  
44 sub list {
45 19 ▶ my ( $self, %args ) = @_;
Subroutine list: called CC=1 SCAR=0.0
Pod documented
46 19 $self->_validate_user_repo_args( \%args );
47 return $self->request(
48 method => 'GET',
49 path => sprintf(
50 '/repos/%s/%s/collaborators', delete $args{user},
51 delete $args{repo}
52 13 ),
53 %args,
54 );
55 }
56  
57  
58 sub remove {
59 4 ▶ my ( $self, %args ) = @_;
Subroutine remove: called CC=2 SCAR=6.9
Pod documented
60 croak 'Missing key in parameters: collaborator'
61 4 ▶ unless $args{collaborator};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"collaborator"} 1 3 4
62 3 $self->_validate_user_repo_args( \%args );
63 return $self->request(
64 method => 'DELETE',
65 path => sprintf(
66 '/repos/%s/%s/collaborators/%s', delete $args{user},
67 delete $args{repo}, delete $args{collaborator}
68 3 ),
69 %args
70 );
71 }
72  
73 16 1;
74  
75 __END__
« Pithub/Issues/Events.pm ↑ Summary Pithub/Repos/Keys.pm »