File: Gitignore.pm

package info (click to toggle)
libnet-github-perl 1.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 2,073; makefile: 8
file content (76 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package Net::GitHub::V3::Gitignore;

use Moo;

our $VERSION = '1.05';
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 };
    }

    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>