File Coverage

blib/lib/Pithub/Repos/Forks.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 2 2 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Pithub::Repos::Forks;
2             our $AUTHORITY = 'cpan:PLU';
3             our $VERSION = '0.01039';
4             # ABSTRACT: Github v3 Repo Forks API
5              
6 15     15   93 use Moo;
  15         28  
  15         81  
7 15     15   7339 use Carp ();
  15         40  
  15         3741  
8             extends 'Pithub::Base';
9              
10              
11             sub create {
12 4     4 1 9245 my ( $self, %args ) = @_;
13 4         31 $self->_validate_user_repo_args( \%args );
14 4 100       17 if ( my $org = delete $args{org} ) {
15             return $self->request(
16             method => 'POST',
17 2         29 path => sprintf( '/repos/%s/%s/forks', delete $args{user}, delete $args{repo} ),
18             data => { organization => $org },
19             %args,
20             );
21             }
22             return $self->request(
23             method => 'POST',
24 2         13 path => sprintf( '/repos/%s/%s/forks', delete $args{user}, delete $args{repo} ),
25             %args,
26             );
27             }
28              
29              
30             sub list {
31 19     19 1 2342 my ( $self, %args ) = @_;
32 19         68 $self->_validate_user_repo_args( \%args );
33             return $self->request(
34             method => 'GET',
35 13         78 path => sprintf( '/repos/%s/%s/forks', delete $args{user}, delete $args{repo} ),
36             %args,
37             );
38             }
39              
40             1;
41              
42             __END__