Lubomir Rintel > WWW-GoodData-1.9 > WWW::GoodData::Agent

Download:
WWW-GoodData-1.9.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.0   Source   Latest Release: WWW-GoodData-1.11

NAME ^

WWW::GoodData::Agent - HTTP client for GoodData JSON-based API

SYNOPSIS ^

  use WWW::GoodData::Agent;
  my $ua = new WWW::GoodData::Agent;
  my $metadata = $ua->get ('/md');

DESCRIPTION ^

WWW::GoodData::Agent is HTTP user agent that makes it easy for follow specifics of the GoodData service API, transparently handles conversion to and from JSON content type and recognizes and handles various kinds of exceptions and error states.

It is a subclass of LWP::UserAgent and follows its semantics unless documented otherwise.

PROPERTIES ^

root

URI object pointing to root of the service API.

This is used to resolve relative request paths.

METHODS ^

new ROOT, PARAMS

Creates a new agent instance. First argument is root of the service API, the rest is passed to LWP::UserAgent as is.

Compared to stock LWP::UserAgent, it has a memory-backed cookie storage and sets the Accept header to prefer JSON content.

post URI, BODY, PARAMS

Constructs and issues a POST request.

Compared to stock LWP::UserAgent, the extra body parameter is encoded into JSON and set as request content, which is the only way to set the request content.

The rest of parameters are passed to LWP::UserAgent untouched.

put URI, BODY, PARAMS

Constructs and issues a PUT request.

Compared to stock LWP::UserAgent, the extra body parameter is encoded into JSON and set as request content, which is the only way to set the request content.

The rest of parameters are passed to LWP::UserAgent untouched.

delete URI

Convenience method for constructing and issuing a DELETE request.

request PARAMS

This call is common for all request types.

While API is same as stock LWP::UserAgent, relative URIs are permitted and extra content processing is done with the response.

Namely, errors are either handled or turned into exceptions and known content types (JSON) are decoded.

SEE ALSO ^

COPYRIGHT ^

Copyright 2011, 2012, 2013 Lubomir Rintel

Copyright 2012 Jan Orel

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

AUTHOR ^

Lubomir Rintel lkundrak@v3.sk

syntax highlighting: