\Revel\ApiEstablishments

API wrapper that deals with {@link Establishment establishments}.

Summary

Methods
Properties
Constants
__construct()
buildApiUrl()
get()
post()
all()
findById()
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

all()

all() : array<mixed,\Revel\Models\Establishment>

Get all {@link Establishment establishments}.

Returns

array<mixed,\Revel\Models\Establishment>

findById()

findById(integer|string  $id) : \Revel\Models\Establishment

Find one establishment using its ID.

Parameters

integer|string $id

The establishment ID or resource URL.

Returns

\Revel\Models\Establishment

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