\Revel\ApiOrdering

Summary

Methods
Properties
Constants
__construct()
buildApiUrl()
get()
post()
submit()
No public properties found
No constants found
call()
cache()
$revel
N/A
No private methods found
$_cache
N/A

Properties

$_cache

$_cache : array

Type

array

Methods

__construct()

__construct(\Revel\Revel  $revel) 

Api constructor.

Parameters

\Revel\Revel $revel

Reference to the core {@link Revel} object.

buildApiUrl()

buildApiUrl(string  $resource) : string

Builds an API URL relative to {@link getFullUrl()}.

Parameters

string $resource

The resource relative to {@link getFullUrl()}.

Returns

string

get()

get(string  $resource) : \Revel\Api\Response

GET resource data.

Parameters

string $resource

The API endpoint, relative to the domain.

Returns

\Revel\Api\Response

post()

post(string  $resource, array  $body = array()) : \Revel\Api\Response

POST to a resource.

Parameters

string $resource

The API endpoint, relative to the domain.

array $body

The POST body.

Returns

\Revel\Api\Response

submit()

submit(\Revel\Models\Order  $order) : integer

Submit an online order.

Parameters

\Revel\Models\Order $order

The order to submit.

Throws

\Exception

If the API returns any errors.

Returns

integer —

The order ID provided by Revel if the order was submitted successfully.

call()

call(string  $method, string  $resource, array  $body = array()) : \Revel\Api\Response

Perform a Revel API request.

Parameters

string $method

The HTTP method.

string $resource

The API endpoint, relative to the domain.

array $body

The request body.

Returns

\Revel\Api\Response

cache()

cache(string  $key, mixed|callable  $value) : mixed

Cache the result of the API call for future access.

Parameters

string $key

Unique key.

mixed|callable $value

Returns

mixed