Class: Extensiv::CartOrder

Inherits:
Resource show all
Defined in:
lib/extensiv/cart/cart_order.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Extensiv::Resource

Instance Method Details

#batch_create(*attributes) ⇒ Object



22
23
24
# File 'lib/extensiv/cart/cart_order.rb', line 22

def batch_create(*attributes)
  Response.new post_request("cart/orders/batch", body: attributes).body["response"]
end

#cancel(cust_ref:) ⇒ Object



26
27
28
# File 'lib/extensiv/cart/cart_order.rb', line 26

def cancel(cust_ref:)
  Response.new get_request("cart/orders/wms_cancel/#{cust_ref}").body["response"]
end

#create(**attributes) ⇒ Object



18
19
20
# File 'lib/extensiv/cart/cart_order.rb', line 18

def create(**attributes)
  Response.new post_request("cart/orders/cartrover", body: attributes).body
end

#list(status:, **params) ⇒ Object



13
14
15
16
# File 'lib/extensiv/cart/cart_order.rb', line 13

def list(status:, **params)
  response = get_request("cart/orders/list/#{status}", params: params)
  Collection.from_response(response, type: Order, params: params)
end

#retrieve(cust_ref:) ⇒ Object



5
6
7
# File 'lib/extensiv/cart/cart_order.rb', line 5

def retrieve(cust_ref:)
  Order.new get_request("cart/orders/#{cust_ref}").body["response"]
end

#status(cust_ref:) ⇒ Object



9
10
11
# File 'lib/extensiv/cart/cart_order.rb', line 9

def status(cust_ref:)
  OrderStatus.new get_request("cart/orders/status/#{cust_ref}").body["response"]
end

#update_status_confirmed(cust_ref:, **attributes) ⇒ Object



30
31
32
# File 'lib/extensiv/cart/cart_order.rb', line 30

def update_status_confirmed(cust_ref:, **attributes)
  Response.new post_request("cart/orders/update/#{cust_ref}", body: attributes).body
end