Net::Dopplr - interface with Dopplr.com's web service
my $dopplr = Net::Dopplr->new($token); my $fellows = $dopplr->fellows('muttley'); print "I share my trips with ".scalar(@{$fellows->{show_trips_to}})." people\n"; print "I can see ".scalar(@{$fellows->{can_see_trips_of}})." people's trips\n";
This is a bit involved because Dopplr is still in beta.
First visit this URL
https://www.dopplr.com/api/AuthSubRequest?next=http%3A%2F%2Fwww.example.com%2Fdopplrapi&scope=http%3A%2F%2Fwww.dopplr.com%2F&session=1
(Or you can replace next with you own web app). That will give you a developer token.
You can then upgrade this to a permanent session token using the dopplr utility shipped with this module or code similar to this
dopplr
use strict; use Net::Google::AuthSub; my $token = shift; my $auth = Net::Google::AuthSub->new( url => 'https://www.dopplr.com/api'); $auth->auth('null', $token); my $sess = $auth->session_token() || die "Couldn't get token: $@"; print "Session token = $sess\n";
and then later
my $dopplr = Net::Dopplr->new($sess);
You can then use the session token from that point forward.
More information here
http://dopplr.pbwiki.com/API+Resource+URLs
Requires a developer token or a session token.
Get people traveller shares information with.
traveller
If traveller is not provided then defaults to the logged-in user.
Get information about a traveller.
Get info about the trips of a traveller.
Returns a list of all trips entered by the selected user that have yet to finish.
Get which of traveller's fellows are travelling today.
Returns data about all trips with a specific tag.
For more information about tags see
http://dopplr.pbwiki.com/Tags
Returns the location of a traveller on a particular date.
Date should be in ISO date format e.g
2007-04-01
Get info about a specific trip.
Get coincidences for a given trip.
Add tags to a trip.
Add a note to a trip.
Delete a trip
Get info about a City.
Use search to get the geoname id.
Alternatively pass in a woeid using
$dopplr->city_info( woeid => $woeid );
Add a trip for the currently logged in user.
$dopplr->add_trip( woeid => $woeid, $start, $finish );
Dates should be in ISO date format e.g
Get all your fellow travellers trips to a given city.
Searches for travellers or cities.
Searches for cities.
Searches for travellers.
Get tips for a city. The returned tips will be tips that can be seen by the currently authenticated user, so may include private tips that only this user can see, as well as public tips on the city.
$dopplr->tips( woeid => $woeid );
Add a tip for a city. The response is the tip you just added.
Opts is a hash where the keys can be
public url address tags
$dopplr->add_tip( woeid => $woeid, $title, $review, %opts );
See http://dopplr.pbwiki.com/method%3Aadd_tip for more details.
Update a traveller's details.
Takes a hash with the new values. Possible keys are
email forename surname password
This is the future proofing method.
If there's any method I haven't implemented yet then you can simply provide the name of the method, the options as a hash ref and, optionally, whether it should be a POST request or not. So, for a theoretical new method called throw_penguin which throws a penguin at a traveller and is called as a POST
throw_penguin
$dopplr->call('throw_penguin', { traveller_id => $id }, 1);
and for get_penguins which finds how many penguins have been thrown at a traveller and is called as a GET
get_penguins
use Data::Dumper; my $data = $dopplr->call('get_penguins', { traveller_id => $id }); print Dumper($data);
Simon Wistow <simon@thegestalt.org>
Copyright 2008, Simon Wistow
Distributed under the same terms as Perl itself.
To install Net::Dopplr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Dopplr
CPAN shell
perl -MCPAN -e shell install Net::Dopplr
For more information on module installation, please visit the detailed CPAN module installation guide.