Documentation

Requestor
in package

Table of Contents

handleApiError()  : mixed
Handles API errors returned from EasyPost.
interpretResponse()  : mixed
Interpret the response body we receive from the API.
request()  : array<string|int, mixed>
Make a request to the EasyPost API.
urlEncode()  : string
URL Encodes data for GET requests.
utf8()  : string
Converts a set of values to UTF-8 encoding.
absoluteUrl()  : string
Get the API URL.
encodeObjects()  : array<string|int, mixed>|string
Encodes an EasyPost object and prepares the data for the request.
requestRaw()  : array<string|int, mixed>
Internal logic required to make a request to the EasyPost API.

Methods

handleApiError()

Handles API errors returned from EasyPost.

public static handleApiError(string $httpBody, int $httpStatus, array<string|int, mixed> $response) : mixed
Parameters
$httpBody : string
$httpStatus : int
$response : array<string|int, mixed>
Tags
throws
GatewayTimeoutException
throws
InternalServerException
throws
InvalidRequestException
throws
JsonException
throws
MethodNotAllowedException
throws
NotFoundException
throws
PaymentException
throws
RateLimitException
throws
RedirectException
throws
ServiceUnavailableException
throws
TimeoutException
throws
UnauthorizedException
throws
UnknownApiException
Return values
mixed —

interpretResponse()

Interpret the response body we receive from the API.

public static interpretResponse(string $httpBody, int $httpStatus) : mixed
Parameters
$httpBody : string
$httpStatus : int
Tags
throws
JsonException
Return values
mixed —

request()

Make a request to the EasyPost API.

public static request(EasyPostClient $client, string $method, string $url[, mixed $params = null ][, bool $beta = false ]) : array<string|int, mixed>
Parameters
$client : EasyPostClient
$method : string
$url : string
$params : mixed = null
$beta : bool = false
Return values
array<string|int, mixed> —

urlEncode()

URL Encodes data for GET requests.

public static urlEncode(mixed $arr[, null $prefix = null ]) : string
Parameters
$arr : mixed
$prefix : null = null
Return values
string —

utf8()

Converts a set of values to UTF-8 encoding.

public static utf8(mixed $value) : string
Parameters
$value : mixed
Return values
string —

absoluteUrl()

Get the API URL.

private static absoluteUrl(EasyPostClient $client[, string $url = '' ][, bool $beta = false ]) : string
Parameters
$client : EasyPostClient
$url : string = ''
$beta : bool = false
Return values
string —

encodeObjects()

Encodes an EasyPost object and prepares the data for the request.

private static encodeObjects(mixed $data) : array<string|int, mixed>|string
Parameters
$data : mixed
Return values
array<string|int, mixed>|string —

requestRaw()

Internal logic required to make a request to the EasyPost API.

private static requestRaw(EasyPostClient $client, string $method, string $url, mixed $params[, bool $beta = false ]) : array<string|int, mixed>
Parameters
$client : EasyPostClient
$method : string
$url : string
$params : mixed
$beta : bool = false
Tags
throws
HttpException
throws
TimeoutException
Return values
array<string|int, mixed> —

Search results