Hatena::API::Auth - Perl intaface to the Hatena Authentication API


Hatena-API-Auth documentation  | view source Contained in the Hatena-API-Auth distribution.

Index


NAME

Top

Hatena::API::Auth - Perl intaface to the Hatena Authentication API

VERSION

Top

Version 0.04

SYNOPSIS

Top

    use Hatena::API::Auth;

    my $api = Hatena::API::Auth->new({
        api_key => '...',
        secret  => '...',
    });

    my $uri = $api->uri_to_login;
    print $uri->as_string;

    my $cert = $q->param('cert');
    my $user = $api->login($cert) or die "Couldn't login: " . $api->errstr;
    $user->name;
    $user->image_url;
    $user->thumbnail_url;

DESCRIPTION

Top

A simple interface for using the Hatena Authentication API http://auth.hatena.ne.jp/.

METHODS

Top

new({ api_key => '...', secret => '...' })

Returns an instance of Hatena::API::Auth. It requires two parameters, "api_key" and "secret" which can be retrieved from the Web site of Hatena Authentication API (http://auth.hatena.ne.jp/).

uri_to_login(%extra)

Returns a URI object which is associated with the login url and required parameters. You can also use this method in your templates of Template like this:

  <a href="[% api.uri_to_login %]">login</a>

uri_to_login takes extra URI parameters as arguments like this:

  <a href="[% api.uri_to_login(foo => 'bar', bar => 'baz') %]">login</a>

Then extracted URI will have extra URI parameters such as foo=bar&bar=baz. Those parameters will be passed to the Authentication API. They will be returned to your application as query parameters of the callback URL.

login($cert)

Logs into Hatena with a Web API and returns a Hatena::API::Auth::User object which knows some information of the logged user. It requires "cert", which can be retrieved from the web site, as an argument.

The user object has some accessor for user's information.

name()

Returns an account name on Hatena.

image_url()

Returns a url of a user's profile image.

thumbnail_url()

Returns a url of a thumbnail of user's profile image.

api_sig($request)

An internal method for generating signatures.

ua

Set/Get HTTP a user-agent for custormizing its behaviour.

AUTHOR

Top

Naoya Ito, <naoya at bloghackers.net>

BUGS

Top

Please report any bugs or feature requests to bug-hatena-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hatena-API-Auth. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Hatena::API::Auth

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Hatena-API-Auth

* CPAN Ratings

http://cpanratings.perl.org/d/Hatena-API-Auth

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Hatena-API-Auth

* Search CPAN

http://search.cpan.org/dist/Hatena-API-Auth

SEE ALSO

Top

Hatena Authentication API http://auth.hatena.ne.jp/ Hatena http://www.hatena.ne.jp/

COPYRIGHT & LICENSE

Top


Hatena-API-Auth documentation  | view source Contained in the Hatena-API-Auth distribution.