Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the API for .gitignore templates
- Loading branch information
Vincent Lequertier
committed
Jan 30, 2016
1 parent
dc77a22
commit a910fa2
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package Net::GitHub::V3::Gitignore; | ||
|
||
use Moo; | ||
|
||
our $VERSION = '0.60'; | ||
our $AUTHORITY = 'cpan:FAYLAND'; | ||
|
||
use URI::Escape; | ||
|
||
with 'Net::GitHub::V3::Query'; | ||
|
||
sub templates { | ||
my ( $self, $args ) = @_; | ||
|
||
# for old | ||
unless (ref($args) eq 'HASH') { | ||
$args = { type => $args }; | ||
} | ||
|
||
my $uri = URI->new('/gitignore/templates'); | ||
$uri->query_form($args); | ||
return $self->query($uri->as_string); | ||
} | ||
|
||
sub template { | ||
my ( $self, $template, $args ) = @_; | ||
|
||
# for old | ||
unless (ref($args) eq 'HASH') { | ||
$args = { type => $args }; | ||
} | ||
print $args; | ||
my $uri = URI->new("/gitignore/templates/" . uri_escape($template)); | ||
$uri->query_form($args); | ||
return $self->query($uri->as_string); | ||
} | ||
|
||
no Moo; | ||
|
||
1; | ||
__END__ | ||
=head1 NAME | ||
Net::GitHub::V3::Gitignore - GitHub Gitignore API | ||
=head1 SYNOPSIS | ||
use Net::GitHub::V3; | ||
my $gh = Net::GitHub::V3->new; # read L<Net::GitHub::V3> to set right authentication info | ||
my $gitignore = $gh->gitignore; | ||
=head1 DESCRIPTION | ||
=head2 METHODS | ||
=head3 Gitignore | ||
L<http://developer.github.com/v3/gitignore/> | ||
=over 4 | ||
=item templates | ||
my @templates = $gitignore->templates(); | ||
=item template | ||
my template = $gitignore->template('Perl'); | ||
=back | ||
=head1 AUTHOR & COPYRIGHT & LICENSE | ||
Refer L<Net::GitHub> |