NAME
Wing::Client - A simple client to Wing's web services.
VERSION
version 0.0402
SYNOPSIS
use Wing::Client;
my $wing = Wing::Client->new(uri => 'https://www.thegamecrafter.com');
my $game = $wing->get('game/528F18A2-F2C4-11E1-991D-40A48889CD00');
my $session = $wing->post('session', { username => 'me', password => '123qwe', api_key_id => 'abcdefghijklmnopqrztuz' });
$game = $wing->put('game/528F18A2-F2C4-11E1-991D-40A48889CD00', { session_id => $session->{id}, name => 'Lacuna Expanse' });
my $status = $wing->delete('game/528F18A2-F2C4-11E1-991D-40A48889CD00', { session_id => $session->{id} });
DESCRIPTION
A light-weight wrapper for Wing's (https://github.com/plainblack/Wing) RESTful API (an example of which can be found at: https://www.thegamecrafter.com/developer/). This wrapper basically hides the request cycle from you so that you can get down to the business of using the API. It doesn't attempt to manage the data structures or objects the web service interfaces with.
METHODS
The following methods are available.
new ( params )
Constructor.
- params
-
A hash of parameters.
- uri
-
The base URI of the service you're interacting with. Example:
https://www.thegamecrafter.com
. - agent
-
A LWP::UserAgent object used to keep a persistent cookie_jar across requests.
get(path, params)
Performs a GET
request, which is used for reading data from the service.
- path
-
The path to the REST interface you wish to call. You can abbreviate and leave off the
/api/
part if you wish. - params
-
A hash reference of parameters you wish to pass to the web service.
delete(path, params)
Performs a DELETE
request, deleting data from the service.
- path
-
The path to the REST interface you wish to call. You can abbreviate and leave off the
/api/
part if you wish. - params
-
A hash reference of parameters you wish to pass to the web service.
put(path, params)
Performs a PUT
request, which is used for updating data in the service.
- path
-
The path to the REST interface you wish to call. You can abbreviate and leave off the
/api/
part if you wish. - params
-
A hash reference of parameters you wish to pass to the web service.
post(path, params)
Performs a POST
request, which is used for creating data in the service.
- path
-
The path to the REST interface you wish to call. You can abbreviate and leave off the
/api/
part if you wish. - params
-
A hash reference of parameters you wish to pass to the web service.
PREREQS
HTTP::Thin Ouch HTTP::Request::Common HTTP::CookieJar JSON URI Moo
SUPPORT
AUTHOR
JT Smith <jt_at_plainblack_dot_com>
LEGAL
This module is Copyright 2013 Plain Black Corporation. It is distributed under the same terms as Perl itself.