ShipmentService
extends BaseService
in package
Shipment service containing all the logic to make API calls.
Table of Contents
- $client : EasyPostClient
- all() : mixed
- Retrieve all shipments.
- buy() : mixed
- Buy a shipment.
- create() : mixed
- Create a shipment.
- generateForm() : mixed
- Generate a form for the shipment.
- getNextPage() : mixed
- Retrieve the next page of Shipment collection
- getSmartRates() : array<string|int, mixed>
- Get SmartRates for a shipment.
- insure() : mixed
- Insure the shipment.
- label() : mixed
- Convert the label format of the shipment.
- lowestSmartRate() : Rate
- Get the lowest SmartRate of the shipment.
- recommendShipDate() : mixed
- Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, based on a specific desired delivery date.
- refund() : mixed
- Refund a shipment.
- regenerateRates() : mixed
- Re-rate a shipment.
- retrieve() : mixed
- Retrieve a shipment.
- retrieveEstimatedDeliveryDate() : mixed
- Retrieves the estimated delivery date of each Rate via SmartRate.
- __construct() : mixed
- Service constructor shared by all child services.
- allResources() : mixed
- Internal retrieve all method.
- className() : string
- The class name of an object.
- classUrl() : string
- The class URL of an object.
- createResource() : mixed
- Internal create method.
- deleteResource() : void
- Internal delete method.
- getNextPageResources() : mixed
- Internal retrieve next page method.
- instanceUrl() : string
- The instance URL of an object.
- retrieveResource() : mixed
- Internal retrieve method.
- serviceModelClassName() : string
- Gets the class name of a Service's model.
- updateResource() : mixed
- Internal update method.
- validate() : void
- Validate library usage.
Properties
$client
protected
EasyPostClient
$client
Methods
all()
Retrieve all shipments.
public
all([mixed $params = null ]) : mixed
Parameters
- $params : mixed = null
Return values
mixed —buy()
Buy a shipment.
public
buy(string $id[, mixed $params = null ][, string|bool $endShipperId = false ]) : mixed
Parameters
- $id : string
- $params : mixed = null
- $endShipperId : string|bool = false
Return values
mixed —create()
Create a shipment.
public
create([mixed $params = null ]) : mixed
Parameters
- $params : mixed = null
Return values
mixed —generateForm()
Generate a form for the shipment.
public
generateForm(string $id, string $formType[, mixed $formOptions = null ]) : mixed
Parameters
- $id : string
- $formType : string
- $formOptions : mixed = null
Return values
mixed —getNextPage()
Retrieve the next page of Shipment collection
public
getNextPage(mixed $shipments[, int|null $pageSize = null ]) : mixed
Parameters
- $shipments : mixed
- $pageSize : int|null = null
Return values
mixed —getSmartRates()
Get SmartRates for a shipment.
public
getSmartRates(string $id) : array<string|int, mixed>
Parameters
- $id : string
Return values
array<string|int, mixed> —insure()
Insure the shipment.
public
insure(string $id[, mixed $params = null ]) : mixed
Parameters
- $id : string
- $params : mixed = null
Return values
mixed —label()
Convert the label format of the shipment.
public
label(string $id[, mixed $params = null ]) : mixed
Parameters
- $id : string
- $params : mixed = null
Return values
mixed —lowestSmartRate()
Get the lowest SmartRate of the shipment.
public
lowestSmartRate(string $id, int $deliveryDays, string $deliveryAccuracy) : Rate
To exclude a carrier or service, prepend the string with !
.
Parameters
- $id : string
- $deliveryDays : int
- $deliveryAccuracy : string
Return values
Rate —recommendShipDate()
Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, based on a specific desired delivery date.
public
recommendShipDate(string $id, string $desiredDeliveryDate) : mixed
Parameters
- $id : string
- $desiredDeliveryDate : string
Return values
mixed —refund()
Refund a shipment.
public
refund(string $id[, mixed $params = null ]) : mixed
Parameters
- $id : string
- $params : mixed = null
Return values
mixed —regenerateRates()
Re-rate a shipment.
public
regenerateRates(string $id[, mixed $params = null ]) : mixed
Parameters
- $id : string
- $params : mixed = null
Return values
mixed —retrieve()
Retrieve a shipment.
public
retrieve(string $id) : mixed
Parameters
- $id : string
Return values
mixed —retrieveEstimatedDeliveryDate()
Retrieves the estimated delivery date of each Rate via SmartRate.
public
retrieveEstimatedDeliveryDate(string $id, string $plannedShipDate) : mixed
Parameters
- $id : string
- $plannedShipDate : string
Return values
mixed —__construct()
Service constructor shared by all child services.
protected
__construct(EasyPostClient $client) : mixed
Parameters
- $client : EasyPostClient
Return values
mixed —allResources()
Internal retrieve all method.
protected
allResources(string $class[, mixed $params = null ][, bool $beta = false ]) : mixed
Parameters
- $class : string
- $params : mixed = null
- $beta : bool = false
Return values
mixed —className()
The class name of an object.
protected
static className(string $class) : string
Parameters
- $class : string
Return values
string —classUrl()
The class URL of an object.
protected
static classUrl(string $class) : string
Parameters
- $class : string
Return values
string —createResource()
Internal create method.
protected
createResource(string $class[, mixed $params = null ][, bool $beta = false ]) : mixed
Parameters
- $class : string
- $params : mixed = null
- $beta : bool = false
Return values
mixed —deleteResource()
Internal delete method.
protected
deleteResource(string $class, string $id[, mixed $params = null ][, bool $beta = false ]) : void
Parameters
- $class : string
- $id : string
- $params : mixed = null
- $beta : bool = false
Return values
void —getNextPageResources()
Internal retrieve next page method.
protected
getNextPageResources(string $class, mixed $collection[, int|null $pageSize = null ]) : mixed
TODO: Use this method in EndShipper and Batch once the API fully support it.
Parameters
- $class : string
- $collection : mixed
- $pageSize : int|null = null
Return values
mixed —instanceUrl()
The instance URL of an object.
protected
instanceUrl(string $class, string $id) : string
Parameters
- $class : string
- $id : string
Tags
Return values
string —retrieveResource()
Internal retrieve method.
protected
retrieveResource(string $class, string $id[, bool $beta = false ]) : mixed
Parameters
- $class : string
- $id : string
- $beta : bool = false
Return values
mixed —serviceModelClassName()
Gets the class name of a Service's model.
protected
static serviceModelClassName(string $serviceClassName) : string
Parameters
- $serviceClassName : string
Return values
string —updateResource()
Internal update method.
protected
updateResource(string $class, string $id[, mixed $params = null ][, string|null $method = 'patch' ][, bool $beta = false ]) : mixed
Parameters
- $class : string
- $id : string
- $params : mixed = null
- $method : string|null = 'patch'
- $beta : bool = false
Return values
mixed —validate()
Validate library usage.
protected
static validate([mixed $params = null ]) : void
Parameters
- $params : mixed = null