README.md in shipping_easy-0.2.2 vs README.md in shipping_easy-0.3.0
- old
+ new
@@ -58,10 +58,85 @@
* **body** - The request body as a JSON string.
* **api_secret** - Optional. The ShippingEasy API secret for the customer account. Defaults to the global configuration if set.
## API Calls
+### Finding an order
+
+To retrieve a specific order, call the find method on the Order resource class with a ShippingEasy order ID specified.
+
+ ShippingEasy::Resources::Order.find(id: 876)
+
+If successful the call will return a JSON hash with the ShippingEasy order.
+
+Example payload may be found here:
+
+https://gist.github.com/twmills/491b44fb6e78b20c1266
+
+#### Possible Exceptions
+
+##### ShippingEasy::AccessDeniedError
+Your credentials could not be authenticated or the store api_key could not be found.
+
+##### ShippingEasy::ResourceNotFoundError
+The requested resource could not be found.
+
+##### ShippingEasy::InvalidRequestError
+The order could not be created on the server for one or more of the following reasons:
+
+* The API timestamp could not be parsed.
+
+The exception will contain a message that indicates which of these conditions failed.
+
+### Retrieving multiple orders
+
+To retrieve multiple orders, call the find_all method on the Order resource class with a ShippingEasy order ID specified.
+
+ ShippingEasy::Resources::Order.find_all
+
+If successful the call will return a JSON hash included an array of orders and a hash metadata detailing the conditions used in the search as well as pagination details regarding the response.
+
+#### Filtering Parameters
+
+**page**
+: The page to return in the paginated result set.
+
+**per_page**
+: The number of result to include per pagein the paginated result set. Defaults to 50 if not specified and the maximum number of results returned per page is 200.
+
+**last_updated_at**
+: Filters the results by the orders' last updated at timestamp and only returns results with a timestamp newer than or equal to the specified value. Defaults to 1 week ago if not specified. The maxiumum time this value can be set to is 3 months ago.
+
+**status**
+: Filters the results by the orders' ShippingEasy order status. Defaults to "shipped". Possible values are "shipped" and "ready_for_shipment". It is possible to pass an array of statuses, e.g. ["shipping", "ready_for_shipment"].
+
+**page**
+: The page to return in the paginated result set.
+
+**store_api_key**
+: By default orders are searched across all the stores on a customer's account. If you would like to filter on a specific API-driven store, include its API key.
+
+#### Filtering Example
+
+ ShippingEasy::Resources::Order.find_all(page: 1, per_page: 1, status: ["ready_for_shipment", "shipped"], last_updated_at: "2014-05-07 14:42:18 UTC")
+
+An example JSON response may be found here:
+
+https://gist.github.com/twmills/005b3c4ab9c85330a801
+
+#### Possible Exceptions
+
+##### ShippingEasy::AccessDeniedError
+Your credentials could not be authenticated or the store api_key could not be found.
+
+##### ShippingEasy::InvalidRequestError
+The order could not be created on the server for one or more of the following reasons:
+
+* The API timestamp could not be parsed.
+
+The exception will contain a message that indicates which of these conditions failed.
+
### Adding an order
To add an order to a store, simply call the create method on the Order resource class. (A comprehensive list of the data attributes and their definitions can be found below.)
payload = { order: "external_order_identifier" => "ABC123", "subtotal_including_tax" => "12.38", ... }
@@ -89,11 +164,11 @@
The following is a list of attributes that should be provided to the ShippingEasy_Order object as a associative array.
An example hash for the create order API call may be found here: https://gist.github.com/twmills/9349053.
-**ext_order_identifier**
+**external_order_identifier**
: *Required.* The e-commerce system's order ID.
**ordered_at**
: *Required.* Timestamp when the order was created.
@@ -298,9 +373,12 @@
**recipients > line_items > total_excluding_tax**
: Total excluding tax for the line item.
**recipients > line_items > unit_price**
: Unit price of the item.
+
+**recipients > line_items > product_options**
+: Hash of product variations applicable to this line item. E.g. {"color":"red", "size":"XXL"}
### Cancelling an order
Sometimes an e-commerce system will mark an order as shipped outside of the ShippingEasy system. Therefore an API call is required to remove this order from ShippingEasy so that it is not double-shipped.