Module: Orderspace::Endpoint::Orders
Overview
Contains the methods to interact with the orders endpoint.
Instance Method Summary collapse
-
#get_order(order_id) ⇒ Object
Returns an order recognised by its id.
-
#list_orders(options = {}) ⇒ Object
Lists all the orders.
Methods included from Structs
Instance Method Details
#get_order(order_id) ⇒ Object
Returns an order recognised by its id
33 34 35 36 37 |
# File 'lib/orderspace/endpoint/orders.rb', line 33 def get_order(order_id) response = client.get("orders/#{order_id}") Orderspace::Structs.from(JSON.parse(response.body)['order'], Order) end |
#list_orders(options = {}) ⇒ Object
Lists all the orders.
You can pass in options like so:
{ query: { limit: 20 } }
Check tho orderspace API documentation to know all the options available.
24 25 26 27 |
# File 'lib/orderspace/endpoint/orders.rb', line 24 def list_orders( = {}) response = client.get('orders', ) Orderspace::Structs.from(JSON.parse(response.body), OrderList) end |