PX::API - Perl interface to the Peekshows Web Services API.
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', });
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.
PX::API
new($args)
Constructs a new PX::API object storing your api_key and secret.
api_key
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.
$method
$args
PX::API::Response
PX::API::do_sign(1)
api_sig
execute_request($request)
Executes a method call to the API. The $request argument must be a PX::API::Request object.
$request
PX::API::Request
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.
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')
The key you received for your application.
The secret string you received for your application.
method
Then name of the method you wish to call. ie: px.test.echo
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.
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 }
Class::Accessor LWP::UserAgent Digest::MD5
PX::API::Request PX::API::Response http://www.peekshows.com http://services.peekshows.com
Anthony Decena <anthony@1bci.com>
<anthony@1bci.com>
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.
To install PX::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PX::API
CPAN shell
perl -MCPAN -e shell install PX::API
For more information on module installation, please visit the detailed CPAN module installation guide.