NAME

Usergrid::Request - Role that provides HTTP invocation and utility methods

DESCRIPTION

Provides methods for easily invoking HTTP methods.

ATTRIBUTES

organization

Organization name (Read/Write, String, Required).

application

Application name (Read/Write, String, Required).

api_url

The URL for the API server (Read/Write, String, Required).

trace

Enable/disable request and response tracing for debugging and troubleshooting (Read/Write, Boolean, Optional).

user_token

The logged in user context (Read/Write).

METHODS

DELETE ($resource)

Invokes the specified resource with the HTTP DELETE method.

GET ($resource)

Invokes the specified resource with the HTTP GET method.

POST ($resource, $request)

Invokes the specified resource with the HTTP POST method and passes in the JSON request.

POST ($resource, $request)

Invokes the specified resource with the HTTP PUT method and passes in the JSON request.

trace_message ($message)

Utility method to log a message to console if tracing is enabled.

prettify ($message)

Returns a prettified string representation for a JSON encoded object.

json_encode ($hashref)

Returns a JSON object from a hash reference.

json_decode ($json_object)

Returns a hash reference from a JSON object.

collection ($object, $uri)

Returns a Usergrid::Collection object that encapsulates the given hashref and the URI that resulted in it.

SEE ALSO

Usergrid::Client, Usergrid::Collection, Usergrid::Entity

LICENSE

This software is distributed under the Apache 2 license.

AUTHOR

Anuradha Weeraman <anuradha@cpan.org>