Colin Kuskie
and 1 contributors

NAME

Wing::Client - A simple client to Wing's web services.

VERSION

version 1.1000

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.

session_id

A Wing session_id. If set, this is automatically added to all requests because I'm lazy. If you don't want a session_id for a while, set the no_session_id flag on the object.

no_session_id

If set to true, prevents adding the session_id to the request.

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, options)

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.

options
upload

Defaults to 0. If 1 then when you pass a param that is an array reference, the value of that array reference will be assumed to be a file name and will attempt to be uploaded per the inner workings of HTTP::Request::Common.

post(path, params, options)

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.

options
upload

Defaults to 0. If 1 then when you pass a param that is an array reference, the value of that array reference will be assumed to be a file name and will attempt to be uploaded per the inner workings of HTTP::Request::Common.

PREREQS

HTTP::Thin Ouch HTTP::Request::Common HTTP::CookieJar JSON URI Moo

SUPPORT

Repository

http://github.com/rizen/Wing-Client

Bug Reports

http://github.com/rizen/Wing-Client/issues

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.