Pithub/GitData/References.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 4 / 4 totaltotal 100% 48 / 48 CC 6 SCAR 7.4
CC
6
Cov
100%
update
3.0
create
2.0
get
2.0
CRAP 2.1
« Pithub/Repos/Statuses.pm ↑ Summary Pithub/Search.pm »
1 package Pithub::GitData::References;
2 16 our $AUTHORITY = 'cpan:PLU';
3 16 our $VERSION = '0.01041';
4  
5 # ABSTRACT: Github v3 Git Data References 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 create {
13 5 ▶ my ( $self, %args ) = @_;
Subroutine create: called CC=2 SCAR=6.9
Pod documented
14 croak 'Missing key in parameters: data (hashref)'
15 5 ▶ unless ref $args{data} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"data"} eq "HASH" 2 3 5
16 3 $self->_validate_user_repo_args( \%args );
17 return $self->request(
18 method => 'POST',
19 path => sprintf(
20 '/repos/%s/%s/git/refs', delete $args{user}, delete $args{repo}
21 3 ),
22 %args,
23 );
24 }
25  
26  
27 sub get {
28 3 ▶ my ( $self, %args ) = @_;
Subroutine get: called CC=2 SCAR=6.9
Pod documented
29 3 ▶ croak 'Missing key in parameters: ref' unless $args{ref};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"ref"} 1 2 3
30 2 $self->_validate_user_repo_args( \%args );
31 return $self->request(
32 method => 'GET',
33 path => sprintf(
34 '/repos/%s/%s/git/refs/%s', delete $args{user},
35 delete $args{repo}, delete $args{ref}
36 2 ),
37 %args,
38 );
39 }
40  
41  
42 sub list {
43 3 ▶ my ( $self, %args ) = @_;
Subroutine list: called CC=2 SCAR=6.9
Pod documented
44 3 $self->_validate_user_repo_args( \%args );
45 3 ▶ if ( my $ref = $args{ref} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ref = $args{"ref"}) 2 1 3
46 return $self->request(
47 method => 'GET',
48 path => sprintf(
49 '/repos/%s/%s/git/refs/%s', delete $args{user},
50 delete $args{repo}, delete $args{ref}
51 2 ),
52 %args,
53 );
54 }
55 return $self->request(
56 method => 'GET',
57 path => sprintf(
58 '/repos/%s/%s/git/refs', delete $args{user}, delete $args{repo}
59 1 ),
60 %args,
61 );
62 }
63  
64  
65 sub update {
66 6 ▶ my ( $self, %args ) = @_;
Subroutine update: called CC=3 SCAR=11.0
Pod documented
67 6 ▶ croak 'Missing key in parameters: ref' unless $args{ref};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"ref"} 1 5 6
68 croak 'Missing key in parameters: data (hashref)'
69 5 ▶ unless ref $args{data} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"data"} eq "HASH" 2 3 5
70 3 $self->_validate_user_repo_args( \%args );
71 return $self->request(
72 method => 'PATCH',
73 path => sprintf(
74 '/repos/%s/%s/git/refs/%s', delete $args{user},
75 delete $args{repo}, delete $args{ref}
76 3 ),
77 %args,
78 );
79 }
80  
81 16 1;
82  
83 __END__
« Pithub/Repos/Statuses.pm ↑ Summary Pithub/Search.pm »