NAME

PX::API - Perl interface to the Peekshows Web Services API.

SYNOPSIS

    use PX::API;

    my $px = PX::API->new({
			api_key => '13243432434',  #Your api key
			secret  => 's33cr3tttt',   #Your api secret
			});
    my $response = $px->call('px.test.echo', {
					arg1 => 'val1',
					arg2 => 'val2',
					});

DESCRIPTION

A quick and simple perl interface to the Peekshows Web Services API. PX::API uses LWP::UserAgent for communication via the Peekshows Web Services rest interface. Response formats are made available 'plugin' style to allow for an extensible method of adding response types as they become available through the API.

METHODS/SUBROUTINES

new($args)

Constructs a new PX::API object storing your api_key and secret.

call($method,$args)

Calls the specified $method passing along all $args allong with the request. A PX::API::Response object is returned based on the requested format, rest by default. When making authenticated calls, PX::API::do_sign(1) must be called to create a valid api_sig. Will return an error if no secret is present when requiring an api_sig.

execute_request($request)

Executes a method call to the API. The $request argument must be a PX::API::Request object.

auth_url($perms)

Constructs a url that can be used to send users to the Peekshows auth page. This method will create an api_sig automagically, there is no need to set PX::API::do_sign(1), though a secret is required.

CONFIGURATION AND ENVIRONMENT

PX::API uses Class::Accessor::Fast as a base, making most parameters available through its simple get/set interface. ie:

my $api_key = $px->api_key

$px->api_key('41234314344')
api_key

The key you received for your application.

secret

The secret string you received for your application.

method

Then name of the method you wish to call. ie: px.test.echo

args

The list of arguments to be sent with the call to the API.

do_sign

This works as a switch, setting to 0 or 1 will disable or enable call signing respectively.

api_sig

The signature for the last signed API call that was made.

ua

This is the LWP::UserAgent object created during construction. By default the object is created with:

{
agent => "PX::API/$VERSION"
timeout => 60
}

DEPENDENCIES

Class::Accessor LWP::UserAgent Digest::MD5

SEE ALSO

PX::API::Request PX::API::Response http://www.peekshows.com http://services.peekshows.com

AUTHOR

Anthony Decena <anthony@1bci.com>

LICENCE AND COPYRIGHT

Copyright (c) 2007, Anthony Decena <anthony@1bci.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.