File Coverage

blib/lib/Pithub/Issues/Milestones.pm
Criterion Covered Total %
statement 26 26 100.0
branch 10 10 100.0
condition n/a
subroutine 7 7 100.0
pod 5 5 100.0
total 48 48 100.0


line stmt bran cond sub pod time code
1             package Pithub::Issues::Milestones;
2             our $AUTHORITY = 'cpan:PLU';
3             our $VERSION = '0.01039';
4             # ABSTRACT: Github v3 Issue Milestones API
5              
6 16     16   99 use Moo;
  16         21  
  16         98  
7 16     16   4125 use Carp qw( croak );
  16         31  
  16         6595  
8             extends 'Pithub::Base';
9              
10              
11             sub create {
12 5     5 1 8365 my ( $self, %args ) = @_;
13 5 100       37 croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH';
14 3         25 $self->_validate_user_repo_args( \%args );
15             return $self->request(
16             method => 'POST',
17 3         34 path => sprintf( '/repos/%s/%s/milestones', delete $args{user}, delete $args{repo} ),
18             %args,
19             );
20             }
21              
22              
23             sub delete {
24 4     4 1 3063 my ( $self, %args ) = @_;
25 4 100       21 croak 'Missing key in parameters: milestone_id' unless $args{milestone_id};
26 3         16 $self->_validate_user_repo_args( \%args );
27             return $self->request(
28             method => 'DELETE',
29 3         31 path => sprintf( '/repos/%s/%s/milestones/%s', delete $args{user}, delete $args{repo}, delete $args{milestone_id} ),
30             %args,
31             );
32             }
33              
34              
35             sub get {
36 3     3 1 2140 my ( $self, %args ) = @_;
37 3 100       20 croak 'Missing key in parameters: milestone_id' unless $args{milestone_id};
38 2         13 $self->_validate_user_repo_args( \%args );
39             return $self->request(
40             method => 'GET',
41 2         21 path => sprintf( '/repos/%s/%s/milestones/%s', delete $args{user}, delete $args{repo}, delete $args{milestone_id} ),
42             %args
43             );
44             }
45              
46              
47             sub list {
48 2     2 1 1615 my ( $self, %args ) = @_;
49 2         12 $self->_validate_user_repo_args( \%args );
50             return $self->request(
51             method => 'GET',
52 2         22 path => sprintf( '/repos/%s/%s/milestones', delete $args{user}, delete $args{repo} ),
53             %args,
54             );
55             }
56              
57              
58             sub update {
59 5     5 1 3656 my ( $self, %args ) = @_;
60 5 100       23 croak 'Missing key in parameters: milestone_id' unless $args{milestone_id};
61 4 100       21 croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH';
62 3         16 $self->_validate_user_repo_args( \%args );
63             return $self->request(
64             method => 'PATCH',
65 3         26 path => sprintf( '/repos/%s/%s/milestones/%s', delete $args{user}, delete $args{repo}, delete $args{milestone_id} ),
66             %args,
67             );
68             }
69              
70             1;
71              
72             __END__