File Coverage

blib/lib/Pithub/Repos/Stats.pm
Criterion Covered Total %
statement 10 13 76.9
branch 1 2 50.0
condition 1 2 50.0
subroutine 2 2 100.0
pod 1 1 100.0
total 15 20 75.0


line stmt bran cond sub pod time code
1             package Pithub::Repos::Stats;
2             our $AUTHORITY = 'cpan:PLU';
3             our $VERSION = '0.01043';
4              
5             # ABSTRACT: Github v3 repos / stats API
6              
7 16     16   120 use Moo;
  16         54  
  16         107  
8              
9             extends 'Pithub::Base';
10              
11              
12             sub contributors {
13 2     2 1 12034 my ( $self, %args ) = @_;
14              
15             # The default is to not wait for 200
16 2   50     17 my $sleep = delete $args{wait_for_200} || 0;
17 2         21 $self->_validate_user_repo_args( \%args );
18             my $req = {
19             method => 'GET',
20             path => sprintf(
21             '/repos/%s/%s/stats/contributors',
22             delete $args{user}, delete $args{repo}
23 2         36 ),
24             %args
25             };
26 2         25 my $res = $self->request(%$req);
27              
28 2 50       29 if ($sleep) {
29 0         0 while ( $res->response->code == 202 ) {
30 0         0 sleep $sleep;
31 0         0 $res = $self->request(%$req);
32             }
33             }
34 2         16 return $res;
35             }
36              
37             1;
38              
39             __END__