NAME
WWW::Gittip - Implementing the Gittip API more or less
SYNOPSIS
use WWW::Gittip;
my $gt = WWW::Gittip->new;
my $charts = $gt->charts;
my $user_charts = $gt->user_charts('szabgab');
DESCRIPTION
This module provides a Perl interface to the Gittip API. Gittip describes itself as "a way to give small weekly cash gifts to people you love and are inspired by". It is one way you can give small recurring amounts to people who've written open source software that you regularly use.
The API docs of Gittp: https://github.com/gittip/www.gittip.com#api
When necessary, you can get an API key from your account on Gittip at https://www.gittip.com/about/me/account
new
my $gt = WWW::Gittip->new;
my $gt = WWW::Gittip->new( api_key => '123-456' );
api_key
Set/Get the API_KEY
$gt->api_key('123-456');
my $api_key = $gt->api_key;
charts
Returns an array reference from /about/charts.json Each element in the array has the following fields:
{
"active_users" => 50,
"charges" => 25.29,
"date" => "2012-06-22",
"total_gifts" => 62.08,
"total_users" => 621,
"weekly_gifts" => 30.08,
"withdrawals" => 0.00
},
user_charts
$gt->user_charts(USERNAME);
Returns an array referene from /%username/charts.json Each element in the array has the following fields:
{
'date' => '2012-06-08',
'npatrons' => 0,
'receipts' => '0',
'ts_start' => '2012-06-08T12:02:45.182409+00:00'
}
paydays
Returns an array reference from /about/paydays.json Each element in the array has the following fields:
{
'ach_fees_volume' => '0',
'ach_volume' => '0',
'charge_fees_volume' => '2.11',
'charge_volume' => '25.28',
'nachs' => 0,
'nactive' => 25
'ncc_failing' => 1,
'ncc_missing' => 18,
'ncharges' => 11,
'nparticipants' => 175,
'ntransfers' => 49,
'ntippers' => 12,
'transfer_volume' => '24.8',
'ts_end' => '2012-06-08T12:03:19.889215+00:00',
'ts_start' => '2012-06-08T12:02:45.182409+00:00',
},
stats
Returns a reference to a hash from /about/stats.json with lots of keys...
communities
See https://github.com/gittip/www.gittip.com/issues/2014
https://www.gittip.com/for/perl/?limit=20&offset=20
https://github.com/gittip/www.gittip.com/issues/2408
Currently only returns an empty list.
user_public
$gt->user_public(USERNAME);
Returns an hash referene from /%username/public.json Some of the fields look like these:
{
'id' => 25031,
'username' => 'szabgab',
'number' => 'singular',
'on' => 'gittip',
'giving' => undef,
'npatrons' => 7,
'receiving' => '5.01',
'goal' => undef,
'avatar' => 'https://avatars.githubusercontent.com/u/48833?s=128',
'bitcoin' => 'https://blockchain.info/address/1riba1Z6o3man18rASVyiG6NeFAhvf7rU',
'elsewhere' => {
'github' => {
'user_id' => '48833',
'id' => 85177,
'user_name' => 'szabgab'
},
'twitter' => {
'user_id' => '21182516',
'user_name' => 'szabgab',
'id' => 424525
}
},
};
user_tips
Requires API_KEY.
GET /%username/tips.json and returns an array reference of hashes. Each hash is looks like this
{
'username' => 'perlweekly',
'platform' => 'gittip',
'amount' => '1.01'
}
$gt->user_tips($username);
community_members
$gt->community_members('perl');
Given the name of a community, returns a hash with 3 keys: new, give, and receive corresponding to the 3 columns of the https://www.gittip.com/for/perl page.
Each key has an array reference as the value. Each arr has several elements:
{
new => [
{
name => 'szabgab',
},
{
name => 'rjbs',
},
...
],
give => [
...
],
receive => [
...
],
}
There is no official API, so this call is scraping the HTML page. Currently Gittip limits the number of people shown in each column to 100.
The user could set the limt at a lower number using limit=... in the URL. The user can also set the starting user using offset=...
WWW::Gittip sends multiple requests as necessary to fetch all the users. It uses limit=100 and the appropriate offset= for each request.
AUTHOR
Gabor Szabo http://perlmaven.com/
LICENSE
Copyright (c) 2014, Gabor Szabo http://szabgab.com/
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.