The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Jaiku - A perl interface to jaiku.com's API

SYNOPSIS

        use Net::Jaiku;

        my $jaiku = new Net::Jaiku(
                username => 'Example',
                userkey  => 'API Key'
        );

        my $p = $jaiku->getMyPresence;
        print $p->user->url;

        my $rv = $jaiku->setPresence(
                message => 'Reading a book'
        );

ABSTRACT

This module allows easy access to Feeds, Presences and Users at jaiku.com. It requires an API key retreivable from http://api.jaiku.com/ for each username you wish to authenticate.

CONSTRUCTOR

This module has a single constructor:

  • new( ... )

    The new constructor takes the following attributes:

    • <username => $string>

      This is a jaiku.com username. this bit.jaiku.com

    • <userkey => $string>

      The user's key can be obtained by visiting http://api.jaiku.com when logged in as the user.

    • <timeout => $seconds>

      The number of seconds to wait before giving up on the call to Jaiku. (Optional)

METHODS

Net::Jaiku has the following methods:

Feeds

  • getFeed()

    Returns the public feed as seen on the front page.

  • getUserFeed( user => $string )

    Returns a hashref of the feed for the given user. If no user is specified, it will return the feed for the current user. If no user is logged it, it will return undef.

  • getMyFeed()

    A shortcut to the above method for the logged in user. If no user is logged it, it will return undef.

  • getContactsFeed()

    Retrieve a feed of all your contacts and their presences.

  • getChannelFeed( channel => $string )

    Retrieve a feed of the latest posts to a channel.

  • RETURN VALUE

    Feed methods return an object representing the feed. The following keys are available:

    • title

    • url

    • stream[n]->icon

    • stream[n]->content

    • stream[n]->created_at

    • stream[n]->created_at_relative

    • stream[n]->comments

    • stream[n]->url

    • stream[n]->id

    • stream[n]->title

Presences

  • getUserPresence( user => $string )

    Returns the 'presence' for the given user. If no user is specified, it will return the feed for the current user. If no user is logged it, it will return undef.

  • getMyPresence()

    A shortcut to the above method for the logged in user. If no user is logged it, it will return undef.

  • RETURN VALUE

    Presence methods return an object representing the presence. The following keys are available:

    • line

    • user->avatar

    • user->url

    • user->nick

    • user->first_name

    • user->last_name

  • setPresence( message => $string, location => $string_or_arrayref, icon => $integer_or_string, generated => $boolean )

    Set the Jaiku presence for the current user. All options are optional, but it would be pointless to not set either a message or a location.

User Info

  • getUserInfo( user => $string )

    Returns information for the given user. If no user is specified, it will return the feed for the current user. If no user is logged it, it will return undef.

  • getMyInfo()

    A shortcut to the above method for the logged in user. If no user is logged it, it will return undef.

  • RETURN VALUE

    Info methods return an object representing the information. The following keys are available:

    • avatar

    • url

    • nick

    • first_name

    • last_name

    • contacts[n]->avatar

    • contacts[n]->url

    • contacts[n]->nick

    • contacts[n]->first_name

    • contacts[n]->last_name

SETTERS AND GETTERS

  • username( $optional_new_username )

    Returns the current username (after optionally setting)

  • userkey( $optional_new_userkey )

    Returns the current username (after optionally setting)

NOTES

Objects

This module returns a custom object called 'HashInflator'. This is used so you can do $rv->user->id rather than the more cumbersome $rv->{user}->{id}

Once the API settles down, I will investigate creating proper objects that will auto-inflate when they need to.

AUTHOR

Rick Measham <rickm@cpan.org>

COPYRIGHT

Copyright (c) 2007 Rick Measham. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

irc://freenode.net/##jaiku