Class: WooCommerce::OrderNotesResource
- Inherits:
-
Resource
- Object
- Resource
- WooCommerce::OrderNotesResource
show all
- Defined in:
- lib/woo_commerce/resources/order_notes.rb
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#create(order:, note:, **params) ⇒ Object
13
14
15
16
|
# File 'lib/woo_commerce/resources/order_notes.rb', line 13
def create(order:, note:, **params)
attributes = {note: note}
OrderNote.new post_request("orders/#{order}/notes", body: attributes.merge(params)).body
end
|
#delete(order:, id:) ⇒ Object
22
23
24
25
|
# File 'lib/woo_commerce/resources/order_notes.rb', line 22
def delete(order:, id:)
response = delete_request("orders/#{order}/notes/#{id}", params: {force: true})
return true if response.success?
end
|
#list(order:, **params) ⇒ Object
4
5
6
7
|
# File 'lib/woo_commerce/resources/order_notes.rb', line 4
def list(order:, **params)
response = get_request("orders/#{order}/notes", params: params)
Collection.from_response(response, type: OrderNote)
end
|
#retrieve(order:, id:) ⇒ Object
9
10
11
|
# File 'lib/woo_commerce/resources/order_notes.rb', line 9
def retrieve(order:, id:)
OrderNote.new get_request("orders/#{order}/notes/#{id}").body
end
|
#update(order:, id:, **params) ⇒ Object
18
19
20
|
# File 'lib/woo_commerce/resources/order_notes.rb', line 18
def update(order:, id:, **params)
OrderNote.new put_request("orders/#{order}/notes/#{id}", body: params).body
end
|