Pithub/Repos/Contents.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 6 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 3 / 3 totaltotal 100% 40 / 40 CC 5 SCAR 9.4
CC
5
Cov
100%
archive
4.0
get
2.0
BEGIN
1.0
CRAP 2.6
« Pithub/Issues/Labels.pm ↑ Summary Pithub/SearchV3.pm »
1 package Pithub::Repos::Contents;
2 16 our $AUTHORITY = 'cpan:PLU';
3 16 our $VERSION = '0.01041';
4  
5 # ABSTRACT: Github v3 Repo Contents 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 archive {
13 5 ▶ my ( $self, %args ) = @_;
Subroutine archive: called CC=4 SCAR=13.9
Pod documented
14 croak 'Missing key in parameters: archive_format'
15 5 ▶ unless $args{archive_format};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"archive_format"} 1 4 5
16 croak 'Invalid archive_format. Valid formats: tarball, zipball'
17 4 ▶ unless grep $args{archive_format} eq $_, qw(tarball zipball);
Branch: 1 branch
BranchTrueFalseTotal
unless grep(($args{"archive_format"} eq $_), ("tarball", "zipball")) 1 3 4
18 3 $self->_validate_user_repo_args( \%args );
19 return $self->request(
20 method => 'GET',
21 path => sprintf(
22 '/repos/%s/%s/%s/%s', delete $args{user}, delete $args{repo},
23 3 ▶ delete $args{archive_format}, delete $args{ref} || q{}
Condition100%2/2
delete $args{'ref'} || ''
l!l
12
MC/DC100%1/1
delete $args{'ref'} || ''
delete $args{'ref'}
Truth table100%2/2
A
A= delete $args{'ref'}
Aresult
11
00
24 ),
25 %args,
26 );
27 }
28  
29  
30 sub get {
31 3 ▶ my ( $self, %args ) = @_;
Subroutine get: called CC=2 SCAR=6.9
Pod documented
32 3 $self->_validate_user_repo_args( \%args );
33 3 ▶ if ( my $path = delete $args{path} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $path = delete $args{"path"}) 1 2 3
34 return $self->request(
35 method => 'GET',
36 path => sprintf(
37 '/repos/%s/%s/contents/%s', delete $args{user},
38 1 delete $args{repo}, $path
39 ),
40 %args,
41 );
42 }
43 return $self->request(
44 method => 'GET',
45 path => sprintf(
46 '/repos/%s/%s/contents', delete $args{user}, delete $args{repo}
47 2 ),
48 %args,
49 );
50 }
51  
52  
53 sub readme {
54 2 ▶ my ( $self, %args ) = @_;
Subroutine readme: called CC=1 SCAR=0.0
Pod documented
55 2 $self->_validate_user_repo_args( \%args );
56 return $self->request(
57 method => 'GET',
58 path => sprintf(
59 '/repos/%s/%s/readme', delete $args{user}, delete $args{repo}
60 2 ),
61 %args,
62 );
63 }
64  
65 16 1;
66  
67 __END__
« Pithub/Issues/Labels.pm ↑ Summary Pithub/SearchV3.pm »