Download the PHP package quickshiftin/postmates-client without Composer
On this page you can find all versions of the php package quickshiftin/postmates-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quickshiftin/postmates-client
More information about quickshiftin/postmates-client
Files in quickshiftin/postmates-client
Package postmates-client
Short Description Client library for Postmates On Demand Logistics
License MIT
Informations about the package postmates-client
postmates-client
Magento Module
Are you reading this because you need to integrate Postmates into your Magento store? Do yourself a favor and checkout the Postmates Shipping extension; you’ll save time and money!
Overview
An API client for Postmates on demand logistics. You can find the Postmates documentation here.
The Postmates API is RESTful and the Postmates client library extends \Guzzlehttp\Client
. You may easily incorporate the Postmates client into your project using composer.
Installing via Composer
The recommended way to install the Postmates client is through Composer.
Next, run the Composer command to install the latest stable version of postmates-client:
After installing, you need to require Composer's autoloader:
Authentication
You instantiate \Postmates\Client
the same as you would \Guzzlehttp\Client
except there are 2 new required configuration options and one new optional configuration option. The new required options are customer_id
and api_key
which you get once you register your app. There's also an optional configuration option postmates_version
which you can use to ensure consistent fields. Instantiating the client then looks like so
Where $cust_id
and $api_key
are your respective credentials.
API Methods
All the API methods have become public member functions of the \Postmates\Client class.
Request Delivery Quote
Create a Delivery
List Deliveries
When listing deliveries you may filter by one of the order statuses, pending, pickup, pickup_complete, dropoff, canceled, delivered, returned. There are more details on the meanings of each status in the code and on the Postmates API documentation.
Get Delivery Status
Cancel a Delivery
A delivery can only be canceled prior to a courier completing pickup, which means the status must be either pending or pickup.
Return a Delivery
A delivery can only be reversed once the courier completed pickup and before the courier has completed dropoff. This means the status can only be pickup_complete.
Client Library Data Objects
The Postmates client handily converts response JSON objects from the API into objects that subclass \ArrayObject. As a matter of convenience the client library also converts textual timestamps from the response to \DateTime instances.
TODO
- Pagination support and testing
- Configurable Exception handling
- Configurable Dao classes
- Optional Dao instead of id for client library methods
- EG $oDelivery = $oClient->createDelivery(); $oClient->cancelDelivery($oDelivery);