The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::Hatena::Fotolife - A Perl interface to the Hatena::Fotolife Atom API

SYNOPSIS

  use WebService::Hatena::Fotolife;

  my $fotolife = WebService::Hatena::Fotolife->new(
      consumer_key => $consumer_key,
      consumer_secret => $consumer_secret,
      access_token => $token,
      access_token_secret => $token_secret,
  );

  # WSSE
     $fotolife->username($username);
     $fotolife->password($api_password);

  # create a new entry with image filename
  my $EditURI = $fotolife->createEntry(
      title    => $title,
      filename => $filename,
      folder   => $folder,
  );

  # or specify the image source as a scalarref
  my $EditURI = $fotolife->createEntry(
      title     => $title,
      scalarref => \$image_content,
      folder    => $folder,
  );

  # update the entry
  $fotolife->updateEntry($EditURI, title => $title);

  # delete the entry
  $fotolife->deleteEntry($EditURI);

  # retrieve the feed
  my $feed = $fotolife->getFeed;
  my @entries = $feed->entries;
  ...

DESCRIPTION

WebService::Hatena::Fotolife provides an interface to the Hatena::Fotolife Atom API.

This module is a subclass of XML::Atom::Client, so see also the documentation of the base class for more usage.

METHODS

new ( %param )

      my $fotolife = WebService::Hatena::Fotolife->new(
          consumer_key => $consumer_key,
          consumer_secret => $consumer_secret,
          access_token => $token,
          access_token_secret => $token_secret,
      );

    Creates and returns a WebService::Hatena::Fotolife object with your OAuth application's tokens and the user's OAuth access tokens.

    Instead of these four tokens, WSSE user name and API password can be specified by invoking the username and password methods. However, new applications should not use WSSE.

createEntry ( %param )

  # passing an image by filename
  my $EditURI = $fotolife->createEntry(
      title    => $title,
      filename => $filename,
  );

  # or...

  # a scalar ref to the image content
  my $EditURI = $fotolife->createEntry(
      title     => $title,
      scalarref => $scalarref,
  );

Uploads given image to Hatena::Fotolife. Pass in the image source as a filename or a scalarref to the image content. There're some more options described below:

  • title

    Title of the image.

  • filename

    Local filename of the image.

  • scalarref

    Scalar reference to the image content itself.

  • folder

    Place, called "folder" in Hatena::Fotolife, you want to upload your image.

  • generator

    Specifies generator string. Hatena::Fotolife can handle your request along with it. See http://f.hatena.ne.jp/my/config for detail.

updateEntry ( $EditURI, %param )

  my $EditURI = $fotolife->updateEntry(
      $EditURI,
      title => $title,
  );

Updates the title of the entry at $EditURI with given options. Hatena::Fotolife Atom API currently doesn't support to update the image content directly via Atom API.

getFeed

  my $feed = $fotolife->getFeed;

Retrieves the feed. The count of the entries the $feed includes depends on your configuration of Hatena::Fotolife.

use_soap ( [ 0 | 1 ] )

username ( [ $username ] )

password ( [ $password ] )

getEntry ( $EditURI )

deleteEntry ( $EditURI )

See the documentation of the base class, XML::Atom::Client.

Note that username and password are ignored if OAuth authorization is used.

SEE ALSO

  • Hatena::Fotolife

    http://f.hatena.ne.jp/

  • Hatena::Fotolife API documentation

    http://developer.hatena.ne.jp/ja/documents/fotolife/apis/atom

  • Hatena OAuth documentation

    http://developer.hatena.ne.jp/ja/documents/auth/apis/oauth

  • XML::Atom::Client

AUTHOR

Kentaro Kuribayashi, <kentarok@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2005 - 2010 by Kentaro Kuribayashi

Copyright 2013 Hatena <http://www.hatena.ne.jp/company/>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.