WebService::Hatena::Graph - A Perl interface to Hatena::Graph API


WebService-Hatena-Graph documentation  | view source Contained in the WebService-Hatena-Graph distribution.

Index


NAME

Top

WebService::Hatena::Graph - A Perl interface to Hatena::Graph API

SYNOPSIS

Top

  use WebService::Hatena::Graph;

  my $graph = WebService::Hatena::Graph->new(
      username => $username,
      password => $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 );

DESCRIPTION

Top

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.

METHODS

Top

new ( %args )

  my $graph = WebService::Hatena::Graph->new(
      username => $username,
      password => $password,
  );

This method creates and returns a new WebService::Hatena::Graph object.

Both username and password are required. If not passed in, it will croak immediately.

post_data ( %args )

  $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.

post ( %args )

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.

get_data ( %args )

  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.

post_config ( %args )

  $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.

get_config ( %args )

  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.

ua ()

  $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.

SEE ALSO

Top

* Hatena::Graph

http://graph.hatena.ne.jp/

* Hatena::Graph API documentation

http://d.hatena.ne.jp/keyword/%a4%cf%a4%c6%a4%ca%a5%b0%a5%e9%a5%d5api

AUTHOR

Top

Kentaro Kuribayashi <kentaro@cpan.org>

COPYRIGHT AND LICENSE (The MIT License)

Top


WebService-Hatena-Graph documentation  | view source Contained in the WebService-Hatena-Graph distribution.