File Coverage

blib/lib/Net/GitHub/V3/Gists.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 6 0.0
condition n/a
subroutine 3 6 50.0
pod 1 3 33.3
total 13 33 39.3


line stmt bran cond sub pod time code
1             package Net::GitHub::V3::Gists;
2              
3 1     1   8 use Moo;
  1         2  
  1         7  
4              
5             our $VERSION = '1.02';
6             our $AUTHORITY = 'cpan:FAYLAND';
7              
8 1     1   319 use URI::Escape;
  1         2  
  1         367  
9              
10             with 'Net::GitHub::V3::Query';
11              
12             sub gists {
13 0     0 1   my ( $self, $user ) = @_;
14              
15 0 0         my $u = $user ? "/users/" . uri_escape($user) . '/gists' : '/gists';
16 0           return $self->query($u);
17             }
18              
19             sub next_gist {
20 0     0 0   my ( $self, $user ) = @_;
21              
22 0 0         my $u = $user ? "/users/" . uri_escape($user) . '/gists' : '/gists';
23 0           return $self->next($u);
24             }
25              
26             sub close_gist {
27 0     0 0   my ( $self, $user ) = @_;
28              
29 0 0         my $u = $user ? "/users/" . uri_escape($user) . '/gists' : '/gists';
30 0           return $self->close($u);
31             }
32              
33             ## build methods on fly
34             my %__methods = (
35             public_gists => { url => "/gists/public", paginate => 1 },
36             starred_gists => { url => "/gists/starred", paginate => 1 },
37             gist => { url => "/gists/%s" },
38             create => { url => "/gists", method => "POST", args => 1 },
39             update => { url => "/gists/%s", method => "PATCH", args => 1 },
40             star => { url => "/gists/%s/star", method => "PUT", check_status => 204 },
41             unstar => { url => "/gists/%s/star", method => "DELETE", check_status => 204 },
42             is_starred => { url => "/gists/%s/star", method => "GET", check_status => 204 },
43             fork => { url => "/gists/%s/fork", method => "POST" },
44             delete => { url => "/gists/%s", method => "DELETE", check_status => 204 },
45              
46             # http://developer.github.com/v3/gists/comments/
47             comments => { url => "/gists/%s/comments", paginate => 1 },
48             comment => { url => "/gists/%s/comments/%s" },
49             create_comment => { url => "/gists/%s/comments", method => 'POST', args => 1 },
50             update_comment => { url => "/gists/%s/comments/%s", method => 'PATCH', args => 1 },
51             delete_comment => { url => "/gists/%s/comments/%s", method => 'DELETE', check_status => 204 },
52             );
53             __build_methods(__PACKAGE__, %__methods);
54              
55 1     1   8 no Moo;
  1         2  
  1         21  
56              
57             1;
58             __END__