Class: Postmates::Client
- Inherits:
-
Object
- Object
- Postmates::Client
- Includes:
- Configuration, Connection, Request
- Defined in:
- lib/postmates/client.rb
Constant Summary
Constants included from Configuration
Postmates::Configuration::DEFAULT_API_URL, Postmates::Configuration::DEFAULT_HEADERS, Postmates::Configuration::VALID_CONFIGURATION_KEYS
Instance Method Summary collapse
-
#cancel(delivery_id) ⇒ Object
POST /v1/customers/:customer_id/deliveries/:delivery_id/cancel.
-
#create(options = {}) ⇒ Object
POST /v1/customers/:customer_id/deliveries.
-
#initialize ⇒ Client
constructor
A new instance of Client.
-
#list(options = {}) ⇒ Object
GET /v1/customers/:customer_id/deliveries.
-
#quote(options = {}) ⇒ Object
POST /v1/customers/:customer_id/delivery_quotes.
-
#retrieve(delivery_id) ⇒ Object
GET /v1/customers/:customer_id/deliveries/:delivery_id.
-
#return(delivery_id) ⇒ Object
POST /v1/customers/:customer_id/deliveries/:delivery_id/return.
Methods included from Configuration
Methods included from Request
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/postmates/client.rb', line 11 def initialize reset end |
Instance Method Details
#cancel(delivery_id) ⇒ Object
POST /v1/customers/:customer_id/deliveries/:delivery_id/cancel
Returns a Delivery object or the raw Faraday response if raw_response = true
69 70 71 |
# File 'lib/postmates/client.rb', line 69 def cancel(delivery_id) post("customers/#{customer_id}/deliveries/#{delivery_id}/cancel") end |
#create(options = {}) ⇒ Object
POST /v1/customers/:customer_id/deliveries
manifest=“a box of kittens” pickup_name=“The Warehouse” pickup_address=“20 McAllister St, San Francisco, CA” pickup_phone_number=“555-555-5555” pickup_business_name=“Optional Pickup Business Name, Inc.” pickup_notes=“Optional note that this is Invoice #123” dropoff_name=“Alice” dropoff_address=“101 Market St, San Francisco, CA” dropoff_phone_number=“415-555-1234” dropoff_business_name=“Optional Dropoff Business Name, Inc.” dropoff_notes=“Optional note to ring the bell” quote_id=qUdje83jhdk
Returns a Delivery object or the raw Faraday response if raw_response = true
43 44 45 |
# File 'lib/postmates/client.rb', line 43 def create( = {}) post("customers/#{customer_id}/deliveries", ) end |
#list(options = {}) ⇒ Object
GET /v1/customers/:customer_id/deliveries
?filter=ongoing
Returns a list of Delivery objects or the raw Faraday response if raw_response = true
53 54 55 |
# File 'lib/postmates/client.rb', line 53 def list( = {}) get("customers/#{customer_id}/deliveries", ) end |
#quote(options = {}) ⇒ Object
POST /v1/customers/:customer_id/delivery_quotes
pickup_address=“20 McAllister St, San Francisco, CA” dropoff_address=“101 Market St, San Francisco, CA”
Returns a Quote object or the raw Faraday response if raw_response = true
22 23 24 |
# File 'lib/postmates/client.rb', line 22 def quote( = {}) post("customers/#{customer_id}/delivery_quotes", ) end |
#retrieve(delivery_id) ⇒ Object
GET /v1/customers/:customer_id/deliveries/:delivery_id
Returns a Delivery object or the raw Faraday response if raw_response = true
61 62 63 |
# File 'lib/postmates/client.rb', line 61 def retrieve(delivery_id) get("customers/#{customer_id}/deliveries/#{delivery_id}") end |
#return(delivery_id) ⇒ Object
POST /v1/customers/:customer_id/deliveries/:delivery_id/return
Returns a Delivery object or the raw Faraday response if raw_response = true
77 78 79 |
# File 'lib/postmates/client.rb', line 77 def return(delivery_id) post("customers/#{customer_id}/deliveries/#{delivery_id}/return") end |