| PX-API documentation | Contained in the PX-API distribution. |
PX::API::Request - A Peekshows Web Services API request.
use PX::API;
use PX::API::Request;
my $px = PX::API->new({
api_key => '13243432434', #Your api key
secret => 's33cr3tttt', #Your api secret
});
my $req = PX::API::Request->({
method => 'px.test.echo',
args => {},
});
my $resp = $px->execute_request($req);
A Peekshows Web Services API request object. PX::API::Request is
an HTTP::Request subclass, allowing access to any request parameters.
new($args)Constructs a new PX::API::Request object. The $args passed
to this constructor must contain a method to call. Optionally
the constructor will accept args as a list of arguments to pass
with the API request.
Anthony Decena <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.
| PX-API documentation | Contained in the PX-API distribution. |
package PX::API::Request; use warnings; use strict; use Carp; use version; our $VERSION = qv('0.0.3'); use HTTP::Request; our @ISA = qw(HTTP::Request); sub new { my $class = shift; my $args = shift; my $self = HTTP::Request->new(); $self->{'method'} = $args->{'method'}; $self->{'args'} = $args->{'args'}; $self->{'format'} = $args->{'format'} || "rest"; bless $self, $class; $self->method('GET'); $self->uri('http://services.peekshows.com/rest/' . $self->_method_to_uri); return $self; } sub _method_to_uri { my $self = shift; my $uri = $self->{'method'}; $uri =~ s/\./\//g; return $uri; } 1; __END__