NAME

PX::API::Response - A Peekshows Web Services API response.

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 response object from the Peekshows Web Services API. PX::API::Response is a subclass of HTTP::Response allowing for access to any response parameters. Module::Pluggable::Object is used to allow an extensible 'plugin' style method for loading response modules.

CONFIGURATION AND ENVIRONMENT

Along with the response parameters available from HTTP::Response, the following parameters are added for API responses.

success

Set to a 1 or 0 to signify response success or error respectively.

response

The actual content of the response returned from the API call.

err_code

The error code returned from the API call, if an error occurred.

err_string

A description of the error returned from the API call, if an error occurred.

RESPONSE PLUGINS

A response plugin is simply a module that transforms the API response format into a usable perl object. Obviously this is not always necessary and the original structure is always available via $response-{_content}>.

Response plugins are required to have to following methods available via its public api:

format()

The format() method is used by PX::API::Response to match a plugin with the format argument sent to the Peekshows API. This method simply needs to return the name of the plugin format. ie: 'rest', 'json'

parse($content)

The parse() method is called upon completion of an API call and is passed the _content returned from the call. This method need only return the perl object which was created from parsing the content.

DEPENDENCIES

HTTP::Response Module::Pluggable

SEE ALSO

PX::API 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.