NAME
WWW::API - Module for building clients for RESTful web service APIs
VERSION
version 0.01
SYNOPSIS
package WWW::GitHub::Repo;
use WWW::API;
define_api 'https://api.github.com';
get 'repo', '/repos/:user/:repo';
get 'repos', '/users/:user/repos';
1;
package main;
use WWW::GitHub::Repo;
my $gh = WWW::GitHub::Repo -> new;
my $repos = $gh -> repos(user => 'AlexBio');
DESCRIPTION
WWW::API is a minimal framework to build clients for RESTful web service APIs.
SUBROUTINES
define_api $base_url, %opts
Define a new API client with base URL $base_url
.
Available options are:
- encoder
-
A custom data encoding subroutine, used to serialize data sent to the web services. By default data is encoded to www_form_urlencoded.
- decoder
-
A custom data decoding subroutine, use to deserialize data received from the web services. By default data is decoded from JSON.
- headers
-
A custom subroutine that returns an hashref containing HTTP headers.
get $name, $path, %opts
post $name, $path, %opts
put $name, $path, %opts
delete $name, $path, %opts
patch $name, $path, %opts
AUTHOR
Alessandro Ghedini <alexbio@cpan.org>
LICENSE AND COPYRIGHT
Copyright 2012 Alessandro Ghedini.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.