Class: TerminalShop::Resources::Order
- Inherits:
-
Object
- Object
- TerminalShop::Resources::Order
- Defined in:
- lib/terminal_shop/resources/order.rb
Instance Method Summary collapse
-
#create(address_id: , card_id: , variants: , request_options: {}) ⇒ TerminalShop::Models::OrderCreateResponse
Create an order without a cart.
-
#get(id, request_options: {}) ⇒ TerminalShop::Models::OrderGetResponse
Get the order with the given ID.
-
#initialize(client:) ⇒ Order
constructor
private
A new instance of Order.
-
#list(request_options: {}) ⇒ TerminalShop::Models::OrderListResponse
List the orders associated with the current user.
Constructor Details
#initialize(client:) ⇒ Order
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Order.
73 74 75 |
# File 'lib/terminal_shop/resources/order.rb', line 73 def initialize(client:) @client = client end |
Instance Method Details
#create(address_id: , card_id: , variants: , request_options: {}) ⇒ TerminalShop::Models::OrderCreateResponse
Create an order without a cart. The order will be placed immediately.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/terminal_shop/resources/order.rb', line 21 def create(params) parsed, = TerminalShop::OrderCreateParams.dump_request(params) @client.request( method: :post, path: "order", body: parsed, model: TerminalShop::Models::OrderCreateResponse, options: ) end |
#get(id, request_options: {}) ⇒ TerminalShop::Models::OrderGetResponse
Get the order with the given ID.
61 62 63 64 65 66 67 68 |
# File 'lib/terminal_shop/resources/order.rb', line 61 def get(id, params = {}) @client.request( method: :get, path: ["order/%1$s", id], model: TerminalShop::Models::OrderGetResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ TerminalShop::Models::OrderListResponse
List the orders associated with the current user.
41 42 43 44 45 46 47 48 |
# File 'lib/terminal_shop/resources/order.rb', line 41 def list(params = {}) @client.request( method: :get, path: "order", model: TerminalShop::Models::OrderListResponse, options: params[:request_options] ) end |