File Coverage

blib/lib/Net/GitHub/V3/Gists.pm
Criterion Covered Total %
statement 9 12 75.0
branch 0 2 0.0
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 13 19 68.4


line stmt bran cond sub pod time code
1             package Net::GitHub::V3::Gists;
2              
3 1     1   4 use Moo;
  1         1  
  1         4  
4              
5             our $VERSION = '0.60';
6             our $AUTHORITY = 'cpan:FAYLAND';
7              
8 1     1   185 use URI::Escape;
  1         2  
  1         174  
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             ## build methods on fly
20             my %__methods = (
21             public_gists => { url => "/gists/public" },
22             starred_gists => { url => "/gists/starred" },
23             gist => { url => "/gists/%s" },
24             create => { url => "/gists", method => "POST", args => 1 },
25             update => { url => "/gists/%s", method => "PATCH", args => 1 },
26             star => { url => "/gists/%s/star", method => "PUT", check_status => 204 },
27             unstar => { url => "/gists/%s/star", method => "DELETE", check_status => 204 },
28             is_starred => { url => "/gists/%s/star", method => "GET", check_status => 204 },
29             fork => { url => "/gists/%s/fork", method => "POST" },
30             delete => { url => "/gists/%s", method => "DELETE", check_status => 204 },
31              
32             # http://developer.github.com/v3/gists/comments/
33             comments => { url => "/gists/%s/comments" },
34             comment => { url => "/gists/%s/comments/%s" },
35             create_comment => { url => "/gists/%s/comments", method => 'POST', args => 1 },
36             update_comment => { url => "/gists/%s/comments/%s", method => 'PATCH', args => 1 },
37             delete_comment => { url => "/gists/%s/comments/%s", method => 'DELETE', check_status => 204 },
38             );
39             __build_methods(__PACKAGE__, %__methods);
40              
41 1     1   4 no Moo;
  1         1  
  1         3  
42              
43             1;
44             __END__