WebService::ISBNDB::Agent::REST - Agent sub-class for the REST protocol
This module should not be directly used by user applications.
This module implements the REST-based communication protocol for getting data from the isbndb.com service. At present, this is the only protocol the service supports.
This class provides the following methods, most of which are restricted to this class and any sub-classes of it that may be written:
- parse_books($ROOT) (R)
- parse_categories($ROOT) (R)
- parse_publishers($ROOT) (R)
- parse_subjects($ROOT) (R)
Each of these parses the XML response for the corresponding API call. The
$ROOTparameter is a XML::LibXML::Node object, obtained from parsing the XML returned by the service.
Each of these returns a list-reference of objects, even when there is only one result value. All of these methods are restricted to this class and its decendants.
- request($OBJ, $ARGS) (R)
Use the LWP::UserAgent object to make a request on the remote service.
$OBJindicates what type of data request is being made, and
$ARGSis a hash-reference of arguments to be passed in the request. The return value is an object of the WebService::ISBNDB::Iterator class.
This method is restricted to this class, and is the required overload of the request() method from the parent class (WebService::ISBNDB::Agent).
- request_method($OBJ, $ARGS)
Returns the HTTP method (GET, POST, etc.) to use when making the request. The
$ARGSparameters may be used to determine the method (in the case of this protocol, they are ignored since GET is always the chosen HTTP method).
- request_uri($OBJ, $ARGS)
Returns the complete HTTP URI to use in making the request.
$OBJis used to derive the type of data being fetched, and thus the base URI to use. The key/value pairs in the hash-reference provided by
$ARGSare used in the REST protocol to set the query parameters that govern the request.
With no arguments, returns the name of this protocol as a simple string. If an argument is passed, it is tested against the protocol name to see if it is a match, returning a true or false value as appropriate.
The class also implements a constructor method, which is needed to co-operate with the parent class under Class::Std structure. You should generally not have to call the constructor directly:
The data returned by this class is only as accurate as the data retrieved from isbndb.com.
The list of results from calling search() is currently limited to 10 items. This limit will be removed in an upcoming release, when iterators are implemented.
Randy J. Ray <firstname.lastname@example.org>
This module and the code within are released under the terms of the Artistic License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php). This code may be redistributed under either the Artistic License or the GNU Lesser General Public License (LGPL) version 2.1 (http://www.opensource.org/licenses/lgpl-license.php).