NAME
WWW::InstaMapper - Interface to the InstaMapper.com API
SYNOPSIS
use WWW::InstaMapper;
my $instamapper = WWW::InstaMapper->new(
api_key => '1234567890',
ssl => 1,
);
my $position = $instamapper->get_last_position;
print "Last position logged at $position->{timestamp}";
my @positions = $instamapper->get_positions(
num => 500,
from_timestamp => '2009-01-01',
);
for my $position (@positions)
{
print "$position->{device_label} was at lat " .
"$position->{latitude}/long $position->{longitude} " .
"at $position->{timestamp}";
}
DESCRIPTION
This module provides an object-oriented Perl interface to the InstaMapper.com API.
METHODS
new
Returns a new instance of WWW::InstaMapper.
Accepts a hash, containing the following parameters:
api_key (required)
The InstaMapper API key (as a string) or multiple keys (as an array reference of strings) that you would like to retrieve positions for.
ssl (optional)
Boolean indication of whether or not to make API calls via HTTPS.
Please note that in accordance with the InstaMapper API terms, a delay of 10 seconds (or 30 seconds if using SSL) will be enforced between requests via this module.
get_positions
Returns an array of hash references representing position data for the devices whose API keys are associated with this object.
Accepts the following optional parameters:
num
The number of positions to return (maximum of 1000)
from_timestamp
Timestamp of the earliest time you would like positions from
from_unixtime
Epoch timestamp (UTC) of the earliest time you would like positions from
The hash references contain the following data:
device_key
InstaMapper device key
device_label
InstaMapper device label
timestamp
DateTime object representing the time the position was logged, in UTC
latitude
longitude
altitude
Altitude (in meters)
speed
Speed (in meters/second)
heading
Heading (in degrees)
get_last_position
Returns a hash reference containing data on the last position logged for the devices whose API keys are associated with this object.
DEPENDENCIES
DateTime, Date::Parse, LWP::UserAgent, JSON
DISCLAIMER
The author of this module is not affiliated in any way with InstaMapper.com.
Users of this module must be sure to follow the InstaMapper.com API terms of service.
COPYRIGHT AND LICENSE
Copyright (C) 2011 Michael Aquilina. All rights reserved.
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Michael Aquilina, aquilina@cpan.org