\OpenResourceManager\ClientState

ORM Room Client

Communicates with an ORM API to preform room operations.

Summary

Methods
Properties
Constants
__construct()
getORM()
getPage()
setPage()
addPage()
subPage()
getList()
get()
getFromCode()
delete()
deleteFromCode()
store()
No public properties found
No constants found
urlFromRoute()
_get()
_post()
_patch()
_del()
deleteFromIdentifier()
deleteFromUsername()
$baseURL
$route
$page
$orm
$validCodes
N/A
No private methods found
No private properties found
N/A

Properties

$baseURL

$baseURL : null|array

Base API URL

Base API URL comprised of environment variables passed to the ORM constructor.

Type

null|array

$route

$route : string

Base State Route

The base API route for the state client.

Type

string

$page

$page : integer

Results Page

The page of results to get.

Type

integer

$orm

$orm : null|\OpenResourceManager\ORM

ORM Connection

The current ORM connection.

Type

null|\OpenResourceManager\ORM

$validCodes

$validCodes : null|array

Valid Response Codes

Response codes that are used to determine if the api request was a success.

Type

null|array

Methods

__construct()

__construct(\OpenResourceManager\ORM  $orm) 

Client Constructor

Constructs a client.

Parameters

\OpenResourceManager\ORM $orm

getORM()

getORM() : \OpenResourceManager\ORM

Get ORM Connection

Returns the current ORM object

Returns

\OpenResourceManager\ORM

getPage()

getPage() : integer

Get Page

Returns the current page

Returns

integer

setPage()

setPage(integer  $page = 1) 

Set Page

Sets the target page.

Parameters

integer $page

addPage()

addPage(integer  $page = 1) 

Add Page

Adds to the target page.

Parameters

integer $page

subPage()

subPage(integer  $page = 1) 

Subtract Page

Sets the target page back.

Parameters

integer $page

getList()

getList() : \Unirest\Response

Get State List

Gets a list of states.

Returns

\Unirest\Response

get()

get(integer  $id) : \Unirest\Response

Get State

Gets a state by it's ID.

Parameters

integer $id

Returns

\Unirest\Response

getFromCode()

getFromCode(string  $code) : \Unirest\Response

Get State From Code

Gets a state by it's code.

Parameters

string $code

Returns

\Unirest\Response

delete()

delete(integer  $id) : \Unirest\Response

Delete State

Delete a state by it's id.

Parameters

integer $id

Returns

\Unirest\Response

deleteFromCode()

deleteFromCode(string  $code) : \Unirest\Response

Delete State From Code

Deletes a state by it's code.

Parameters

string $code

Returns

\Unirest\Response

store()

store(  $code,   $label,   $country_id = null,   $country_code = null) 

Parameters

$code
$label
$country_id
$country_code

urlFromRoute()

urlFromRoute(string  $path = '') : string

URL From Route

Forms an API url from a route path.

Parameters

string $path

Returns

string

_get()

_get(string  $slug = '') : \Unirest\Response

_Get

Performs a get request to a specified url slug.

Parameters

string $slug

Returns

\Unirest\Response

_post()

_post(array  $fields = array(), string  $slug = '') : \Unirest\Response

_Post

Performs a post request to a specified url slug.

Parameters

array $fields
string $slug

Throws

\Exception

Returns

\Unirest\Response

_patch()

_patch(array  $fields = array(), string  $slug = '') : \Unirest\Response

_Patch

Performs a patch request to a specified url slug.

Parameters

array $fields
string $slug

Throws

\Exception

Returns

\Unirest\Response

_del()

_del(array  $fields = array(), string  $slug = '') : \Unirest\Response

_Del

Performs a delete request to a specified url slug.

Parameters

array $fields
string $slug

Throws

\Exception

Returns

\Unirest\Response

deleteFromIdentifier()

deleteFromIdentifier(string  $identifier) : \Unirest\Response

Delete From Identifier

Delete an object by it's identifier.

Parameters

string $identifier

Returns

\Unirest\Response

deleteFromUsername()

deleteFromUsername(string  $username) : \Unirest\Response

Delete From Username

Delete an object by it's username.

Parameters

string $username

Returns

\Unirest\Response