WebService::Hatena::Graph - A Perl interface to Hatena::Graph API
use WebService::Hatena::Graph; my $graph = WebService::Hatena::Graph->new( consumer_key => $consumer_key, consumer_secret => $consumer_secret, access_token => $token, access_token_secret => $token_secret, username => $username, password => $api_password, ); # set data to the specified graph $graph->post_data( graphname => $graphname, date => $date, value => $value, ); # retrieve graph data my $graph_data = $graph->get_data( graphname => $graphname, username => $username, ); # set config $graph->post_config( graphname => $graphname, graphcolor => $graphcolor, graphtype => $graphtype, status => $status, allowuser => $allowuser, allowgrouplist => $allowgrouplist, stack => $stack, reverse => $reverse, formula => $formula, maxy => $maxy, miny => $miny, showdata => $showdata, nolabel => $nolabel, userline => $userline, userlinecolor => $userlinecolor, comment => $comment, ); # retrieve config my $graph_config = $graph->get_config( graphname => $graphname );
Hatena::Graph is a website which allows users to manage and share daily activities with graphic representaion. WebService::Hatena::Graph provides an easy way to communicate with it using its API.
# OAuth my $graph = WebService::Hatena::Graph->new( consumer_key => $consumer_key, consumer_secret => $consumer_secret, access_token => $token, access_token_secret => $token_secret, ); # WSSE my $graph = WebService::Hatena::Graph->new( username => $username, password => $api_password, );
This method creates and returns a new WebService::Hatena::Graph object.
As arguments to the method, tokens for the OAuth 1.0a application (consumer_key and consumer_secret) and tokens for the user (access_token and access_token_secret) must be specified.
consumer_key
consumer_secret
access_token
access_token_secret
Alternatively, WSSE authorization scheme is also supported. For WSSE, both username and API password are required. If not passed in, it will croak immediately. New applications should not use WSSE.
$graph->post_data( graphname => $graphname, date => $date, value => $value, );
This method sets $value on $date to the graph specified by $graphname parameter.
NOTE: If the graphname parameter isn't passed in or the request ends in failure for some reason, this method will croak immediately. Additionally, you might want to consult the official documentation of Hatena::Graph API to know more about how you can pass the parameters in.
This note is applicable to also all the methods described below except ua() method.
This method is an alias of post_data() method described above, but it's already obsolete and remains only for backward compatibility (less or eaqual version 0.04). Use post_data() instead.
my $graph_data = $graph->get_data( graphname => $graphname, username => $username, );
This method retrieves the data of the graph specified by $graphname and returns a hashref to them.
$graph->post_config( graphname => $graphname, graphcolor => $graphcolor, graphtype => $graphtype, status => $status, allowuser => $allowuser, allowgrouplist => $allowgrouplist, stack => $stack, reverse => $reverse, formula => $formula, maxy => $maxy, miny => $miny, showdata => $showdata, nolabel => $nolabel, userline => $userline, userlinecolor => $userlinecolor, comment => $comment, );
This method sets or updates the configuraions of the graph specified by $graphname.
my $graph_config = $graph->get_config( graphname => $graphname );
This method retrieves the configuraions from the graph specified by $graphname and returns a hashref to them.
$graph->ua->timeout(10);
This method returns LWP::UserAgent object internally used in the WebService::Hatena::Graph object. You can set some other options which are specific to LWP::UserAgent via this method.
Hatena::Graph
http://graph.hatena.ne.jp/
Hatena::Graph API documentation
http://developer.hatena.ne.jp/ja/documents/graph/apis/rest
Hatena OAuth documentation
http://developer.hatena.ne.jp/ja/documents/auth/apis/oauth
Kentaro Kuribayashi <kentaro@cpan.org>
Copyright (c) 2006 - 2007, Kentaro Kuribayashi <kentaro@cpan.org>
Copyright 2013 Hatena <http://www.hatena.ne.jp/company/>.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
To install WebService::Hatena::Graph, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Hatena::Graph
CPAN shell
perl -MCPAN -e shell install WebService::Hatena::Graph
For more information on module installation, please visit the detailed CPAN module installation guide.