File Coverage

blib/lib/Net/GitHub/V3/PullRequests.pm
Criterion Covered Total %
statement 12 20 60.0
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 28 60.7


line stmt bran cond sub pod time code
1             package Net::GitHub::V3::PullRequests;
2              
3 1     1   4 use Moo;
  1         1  
  1         4  
4              
5             our $VERSION = '0.63';
6             our $AUTHORITY = 'cpan:FAYLAND';
7              
8 1     1   188 use URI;
  1         1  
  1         14  
9 1     1   2 use URI::Escape;
  1         1  
  1         191  
10              
11             with 'Net::GitHub::V3::Query';
12              
13             sub pulls {
14 0     0 1   my $self = shift @_;
15 0           my $args = pop @_;
16              
17 0           my ($user, $repos) = ($self->u, $self->repo);
18 0 0         if (scalar(@_) >= 2) {
19 0           ($user, $repos) = @_;
20             }
21              
22 0           my $uri = URI->new('/repos/' . uri_escape($user) . '/' . uri_escape($repos) . '/pulls');
23 0           $uri->query_form($args);
24 0           return $self->query($uri->as_string);
25             }
26              
27             ## build methods on fly
28             my %__methods = (
29              
30             pull => { url => "/repos/%s/%s/pulls/%s" },
31              
32             create_pull => { url => "/repos/%s/%s/pulls", method => "POST", args => 1 },
33             update_pull => { url => "/repos/%s/%s/pulls/%s", method => "PATCH", args => 1 },
34              
35             commits => { url => "/repos/%s/%s/pulls/%s/commits" },
36             files => { url => "/repos/%s/%s/pulls/%s/files" },
37             is_merged => { url => "/repos/%s/%s/pulls/%s/merge", check_status => 204 },
38             merge => { url => "/repos/%s/%s/pulls/%s/merge", method => "PUT" },
39              
40             # http://developer.github.com/v3/pulls/comments/
41             comments => { url => "/repos/%s/%s/pulls/%s/comments" },
42             comment => { url => "/repos/%s/%s/pulls/comments/%s" },
43             create_comment => { url => "/repos/%s/%s/pulls/%s/comments", method => 'POST', args => 1 },
44             update_comment => { url => "/repos/%s/%s/pulls/comments/%s", method => 'PATCH', args => 1 },
45             delete_comment => { url => "/repos/%s/%s/pulls/comments/%s", method => 'DELETE', check_status => 204 },
46              
47             );
48             __build_methods(__PACKAGE__, %__methods);
49              
50 1     1   4 no Moo;
  1         1  
  1         3  
51              
52             1;
53             __END__