WWW::PunchTab - PunchTab REST API
version 0.02
use WWW::PunchTab; use Data::Dumper; my $pt = WWW::PunchTab->new( domain => 'fayland.org', access_key => 'f4f8290698320a98b1044615e722af79', client_id => '1104891876', secret_key => 'ed73f70966dd10b7788b8f7953ec1d07', ); $pt->sso_auth( {'id' => '2', 'first_name' => 'Fayland', 'last_name' => 'Lam', 'email' => 'fayland@gmail.com'} ) or die $pt->errstr; my $x = $pt->create_activity('view', 200) or die $pt->errstr; # view with 200 points print Dumper(\$x);
http://www.punchtab.com/developer-docs#REST-API-Documentation
my $pt = WWW::PunchTab->new( domain => 'fayland.org', access_key => 'f4f8290698320a98b1044615e722af79', client_id => '1104891876', secret_key => 'ed73f70966dd10b7788b8f7953ec1d07', );
domain
access_key
client_id
secret_key
All required.
$pt->sso_auth( {'id' => '2', 'first_name' => 'Fayland', 'last_name' => 'Lam', 'email' => 'fayland@gmail.com'} ) or die $pt->errstr;
print $pt->sso_auth_js({'id' => '2', 'first_name' => 'Fayland', 'last_name' => 'Lam', 'email' => 'fayland@gmail.com'});
js sso auth example:
var _pt_pre_config = { auth_request: 'xxx', signature: 'xxx', timestamp: 1348843966, client_id: 123 };
my $status = $pt->auth_logout or die $pt->errstr;
return 'connected' or 'disconnected'
my $status = $pt->auth_status($access_token) or die $pt->errstr;
my $activity = $pt->activity() or die $pt->errstr; my $activity = $pt->activity('like') or die $pt->errstr;
my $x = $pt->create_activity('view', 200) or die $pt->errstr; # view with 200 points
my $x = $pt->redeem_reward($reward_id) or die $pt->errstr;
my $leaderboard = $pt->leaderboard() or die $pt->errstr; my $leaderboard = $pt->leaderboard( with => 'me', limit => 20, page => 1, ) or die $pt->errstr;
my $reward = $pt->reward() or die $pt->errstr; my $reward = $pt->reward($limit) or die $pt->errstr;
my $user = $pt->user() or die $pt->errstr;
Fayland Lam <fayland@gmail.com>
This software is copyright (c) 2012 by Fayland Lam.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WWW::PunchTab, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::PunchTab
CPAN shell
perl -MCPAN -e shell install WWW::PunchTab
For more information on module installation, please visit the detailed CPAN module installation guide.