|
NAMEWWW::GitHub::Gist - Perl interface to the GitHub's pastebin service VERSIONversion 0.17 SYNOPSIS use WWW::GitHub::Gist;
my $gist = WWW::GitHub::Gist -> new(
id => '1216637',
#user => $username,
#password => $password
);
# Fetch and print information
my $gist_info = $gist -> show;
say $gist_info -> {'description'};
say $gist_info -> {'user'} -> {'login'};
say $gist_info -> {'git_pull_url'};
say $gist_info -> {'git_push_url'};
# Show files
my $files = $gist_info -> {'files'};
foreach my $file (keys %$files) {
say $files -> {$file} -> {'filename'};
say $files -> {$file} -> {'content'};
}
# Create a new gist
my $new_gist_info = $gist -> create(
description => $descr,
public => 1,
files => {'name1' => 'content', 'name2' => 'content'}
);
DESCRIPTIONWWW::GitHub::Gist provides an object-oriented interface for Perl to the gist.github.com API. Gist is a pastebin service operated by GitHub. METHODSnew( )Create a new WWW::GitHub::Gist object. Takes the following arguments:
The username and password are used for the methods that require auth. The username is also used in the list() method. show( $gist_id )Fetch information of the given gist. By default uses the 'id' attribute defined in ->new. Returns an hash ref containing the gist's information. list( $user )List all gists of the given user. By default uses the 'user' attribute defined in ->new. Returns a list of hash refs containing the gists' information. create( %args )Create a new gist. Takes the following arguments:
Returns an hash ref containing the new gist's information. If no credentials are provided, an anonymous gist will be created. edit( %args )Updates a gist. Takes the following arguments:
Returns an hash ref containing the updated gist's information. (requires authentication) fork( $gist_id )Forks the given gist. By default uses the 'id' attribute defined in ->new. Returns an hash ref containing the forked gist's information. (requires authentication) delete( $gist_id )Deletes the given gist. By default uses the 'id' attribute defined in ->new. Returns nothing. (requires authentication) star( $gist_id )Stars the given gist. By default uses the 'id' attribute defined in ->new. Returns nothing. (requires authentication) unstar( $gist_id )Unstars the given gist. By default uses the 'id' attribute defined in ->new. Returns nothing. (requires authentication) AUTHORAlessandro Ghedini <alexbio@cpan.org> LICENSE AND COPYRIGHTCopyright 2011 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.
|