Net::Jaiku - A perl interface to jaiku.com's API
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' );
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.
This module has a single constructor:
new( ... )
The new constructor takes the following attributes:
new
<username => $string>
<username => $string
This is a jaiku.com username. this bit.jaiku.com
<userkey => $string>
<userkey => $string
The user's key can be obtained by visiting http://api.jaiku.com when logged in as the user.
<timeout => $seconds>
<timeout => $seconds
The number of seconds to wait before giving up on the call to Jaiku. (Optional)
Net::Jaiku has the following methods:
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
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()
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.
message
location
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()
Info methods return an object representing the information. The following keys are available:
avatar
nick
first_name
last_name
contacts[n]->avatar
contacts[n]->url
contacts[n]->nick
contacts[n]->first_name
contacts[n]->last_name
username( $optional_new_username )
Returns the current username (after optionally setting)
userkey( $optional_new_userkey )
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.
Rick Measham <rickm@cpan.org>
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.
irc://freenode.net/##jaiku
To install Net::Jaiku, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Jaiku
CPAN shell
perl -MCPAN -e shell install Net::Jaiku
For more information on module installation, please visit the detailed CPAN module installation guide.