\Revel\ApiCategories

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

findById()

findById(integer  $id) : \Revel\Models\Category

Get one category using its ID.

Parameters

integer $id

The category ID.

Returns

\Revel\Models\Category

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