Class: WooCommerce::OrdersResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/woo_commerce/resources/orders.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 WooCommerce::Resource

Instance Method Details

#create(**params) ⇒ Object



13
14
15
# File 'lib/woo_commerce/resources/orders.rb', line 13

def create(**params)
  Order.new post_request("orders", body: params).body
end

#delete(id:) ⇒ Object



21
22
23
24
# File 'lib/woo_commerce/resources/orders.rb', line 21

def delete(id:)
  response = delete_request("orders/#{id}", params: {force: true})
  return true if response.success?
end

#list(**params) ⇒ Object



4
5
6
7
# File 'lib/woo_commerce/resources/orders.rb', line 4

def list(**params)
  response = get_request("orders", params: params)
  Collection.from_response(response, type: Order)
end

#retrieve(id:) ⇒ Object



9
10
11
# File 'lib/woo_commerce/resources/orders.rb', line 9

def retrieve(id:)
  Order.new get_request("orders/#{id}").body
end

#update(id:, **params) ⇒ Object



17
18
19
# File 'lib/woo_commerce/resources/orders.rb', line 17

def update(id:, **params)
  Order.new put_request("orders/#{id}", body: params).body
end