Net-FireEagle
view release on metacpan or search on metacpan
lib/Net/FireEagle.pm view on Meta::CPAN
consumer_secret => $consumer_secret,
access_token => $access_token,
access_token_secret => $access_token_secret );
# Send this to user to grant authorization for this app
my $auth_url = $fe->get_authorization_url;
# ... and request an access token
# Note: you can save these in DB to restore previous Fire Eagle oauth session
my ($access_token, $access_token_secret) = $fe->request_access_token;
# Get them back
my $access_token = $fe->access_token;
my $access_token_secret = $fe->access_token_secret;
# in the case of a web app, you want to save the request tokens
# (and/or set them)
my $request_token = $fe->request_token;
my $request_token_secret = $fe->request_token_secret;
$fe->request_token( $request_token );
$fe->request_token_secret( $request_token_secret );
# Can't query or update location without authorization
my $loc = $fe->location; # returns xml
my $loc = $fe->location( format => 'xml' ); # returns xml
my $loc = $fe->location( format => 'json' ); # returns json
# returns result on success. dies or returns undef on failure
my $return = $fe->update_location( "500 Third St., San Francisco, CA" );
# Find a location. Returns either xml or json
my $return = $fe->lookup_location( "Pensacola" );
=head1 ABOUT
Fire Eagle is a site that stores information about your location. With
your permission, other services and devices can either update that
information or access it. By helping applications respond to your
location, Fire Eagle is designed to make the world around you more
interesting! Use your location to power friend-finders, games, local
information services, blog badges and stuff like that...
For more information see http://fireeagle.yahoo.net/
=head1 AUTHENTICATION
For more information read this
http://fireeagle.yahoo.net/developer/documentation/getting_started
but, in short you have to first get an API key from the FireEagle site.
Then using this consumer key and consumer secret you have to
authenticate the relationship between you and your user. See the script
C<fireagle> packaged with this module for an example of how to do this.
=head1 SIMPLE DAILY USAGE AND EXAMPLE CODE
The script C<fireeagle> shipped with this module gives you really
quick access to your FireEagle account - you can use it to simply
query and update your location.
It also serves as a pretty good example of how to do desktop app
authentication and how to use the API.
=head1 METHODS
=cut
=head2 new <opts>
Create a new FireEagle object. This must have the options
=over 4
=item consumer_key
=item consumer_secret
=back
which you can get at http://fireeagle.yahoo.net/developer/manage
then, when you have your per-user authentication tokens (see above) you
can supply
=over 4
=item access_token
=item access_token_secret
=back
Alternatively when you create a new web-based application, a general-purpose
access token is issued to you along with your application key and secret. You
can get them at http://fireeagle.yahoo.net/developer/manage.
They are tied to your application and allow your application to make
general-purpose API method calls (often batch-style) to Fire Eagle.
You can read about them at
http://fireagle.yahoo.net/developer/documentation/using_oauth#feaccesstokens
You can pass them in using the param
=over 4
=item general_token
=item general_token_secret
=back
=cut
sub new {
my $proto = shift;
my $class = ref $proto || $proto;
my %tokens = @_;
( run in 1.217 second using v1.01-cache-2.11-cpan-39bf76dae61 )