Module: Mercadolibre::Core::OrderNotes

Included in:
Api
Defined in:
lib/mercadolibre/core/order_notes.rb

Instance Method Summary collapse

Instance Method Details

#create_order_note(order_id, text) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/mercadolibre/core/order_notes.rb', line 9

def create_order_note(order_id, text)
  payload = { note: text }.to_json

  headers = { content_type: :json, accept: :json }

  result = post_request("/orders/#{order_id}/notes?access_token=#{@access_token}", payload, headers)
  result.body.note
end

#delete_order_note(order_id, note_id) ⇒ Object



27
28
29
30
# File 'lib/mercadolibre/core/order_notes.rb', line 27

def delete_order_note(order_id, note_id)
  result = delete_request("/orders/#{order_id}/notes/#{note_id}?access_token=#{@access_token}")
  result.status_code == 200
end

#get_order_notes(order_id) ⇒ Object



4
5
6
7
# File 'lib/mercadolibre/core/order_notes.rb', line 4

def get_order_notes(order_id)
  filters = { access_token: @access_token }
  get_request("/orders/#{order_id}/notes", filters).body
end

#update_order_note(order_id, note_id, text) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/mercadolibre/core/order_notes.rb', line 18

def update_order_note(order_id, note_id, text)
  payload = { note: text }.to_json

  headers = { content_type: :json, accept: :json }

  result = put_request("/orders/#{order_id}/notes/#{note_id}?access_token=#{@access_token}", payload, headers)
  result.body.note
end