NAME

Exobrain::Agent::Foursquare - Roles for Exobrain Foursquare agents

VERSION

version 0.01

SYNOPSIS

    use Moose;
    with 'Exobrain::Agent::Foursquare'

DESCRIPTION

This role provides useful methods and attributes for agents wishing to integrate with Foursquare

METHODS

mech

    my $mech = $self->mech;

Returns a WWW::Mechanize object. By default its stack depth is set to zero (which avoid memory leaks in long-running processes), and autocheck is on (so it will throw an exception on error).

Primarily used by "foursquare_api".

auth_token

    my $token = $self->auth_token

Returns the auth_token, taken from the user's configuration.

Primarily used by "foursquare_api".

api_base

Returns the Foursquare API base path to use. By default this is https://api.foursquare.com/v2.

Primarily used by "foursquare_api".

foursquare_api

    my $checkins = $self->foursquare_api('checkins/recent',
        afterTimestamp => $last_check,
    );

Calls the Foursquare API endpoint specified in the first argument, and converts the response into a Perl data structure. All additional named arguments are considered to be parameters that will be appended to the call.

This method automatically adds auth tokens and version strings as appropriate.

AUTHOR

Paul Fenwick <pjf@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Paul Fenwick.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.