Skip to content
gumroad api client
Perl
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
eg
lib/WWW
t
xt
.gitignore
.shipit
Changes
MANIFEST.SKIP
Makefile.PL
README.pod

README.pod

NAME

WWW::Gumroad - HTTP Client for Gumroad API

SYNOPSIS

  use Data::Dumper;
  use WWW::Gumroad;
  use WWW::Gumroad::Authentication;

  my $authen = WWW::Gumroad::Authentication->new;
  my $res = $authen->create($email, $password);
  die Dumper $res->error if $res->is_error;
  my $token = $res->data->{token};

  my $client = WWW::Gumroad->new(token => $token);
  $res = $client->post('links', {
      name        => 'Yappo no onegai',
      url         => 'http://blog.yappo.jp/yappo/archives/yappo-onegai.png'
      price       => '100',
      description => 'Perl-users.jp創設者 大沢Yappo和宏 からの緊急のお願いをお読み下さい',
  });
  die Dumper $res->error if $res->is_error;
  my $link_id = $res->data->{link}{id};

  $res = $client->get("links/$link_id");
  die Dumper $res->error if $res->is_error;
  print Dumper $res->data;

DESCRIPTION

WWW::Gumroad is HTTP Client for Gumroad API.

THIS MODULE IS ALPHA LEVEL INTERFACE. MAY BE CHANGED.

METHODS

new(%args)

Create a new WWW::Gumroad instance.

  my $client = WWW::Gumroad->new(token => $token);

supported options are:

token : Str

Required. Sets authenticated token. You can retrieved using WWW::Gumroad::Authentication.

  my $authen = WWW::Gumroad::Authentication->new;
  my $res = $authen->create($email, $password);
  die Dumper $res->error if $res->is_error;

  my $token = $res->data->{token};
  my $client = WWW::Gumroad->new(token => $token);
api_base_url : Str

Sets Gumroad API base url. default is $WWW::Gumroad::API_BASE_URL.

ua : LWP::UserAgent

Sets HTTP Client. default is LWP::UserAgent.

$client->request(%args)

Request for Gumroad API. Required value is WWW::Gumroad::Response.

  my $res = $client->request(
      method   => 'POST',
      endpoint => '/links',
      content  => {
          name        => 'Yappo no onegai',
          url         => 'http://blog.yappo.jp/yappo/archives/yappo-onegai.png'
          price       => '100',
          description => 'Perl-users.jp創設者 大沢Yappo和宏 からの緊急のお願いをお読み下さい',
      },
  );
  die Dumper $res->error if $res->is_error;
  my $link_id = $res->data->{link}{id};

supported options are:

method : Str

Sets HTTP method, can be specify GET or POST or PUT or DELETE.

endpoint : Str

Sets api path or api url.

content : ARRAY | HASH | Str

Sets request content. You can specify, ARRAY or HASH or Scalar content.

Currently, it will be encoded as application/x-www-form-urlencoded

$client->get($endpoint)

Alias of:

  $client->request(method => 'GET', endpoint => $endpoint);

$client->post($endpoint, $content)

Alias of:

  $client->request(method => 'POST', endpoint => $endpoint, content => $content);

$client->put($endpoint, $content)

Alias of:

  $client->request(method => 'PUT', endpoint => $endpoint, content => $content);

$client->delete($endpoint)

Alias of:

  $client->request(method => 'DELETE', endpoint => $endpoint, content => $content);

AUTHOR

xaicron <xaicron {at} cpan.org>

COPYRIGHT

Copyright 2012 - xaicron

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Something went wrong with that request. Please try again.