mercadolibre 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b6a22e6777e210658732b3b09e1fbc9ed2a30ab
4
- data.tar.gz: 257edbbfb89ae5950f6cdbd2d9364f794fd449a7
3
+ metadata.gz: 1cdd0a8806a54f7bf13f3af7438d96c87ebcf22f
4
+ data.tar.gz: b3625580caf2b132d1b36f95dac2d9c85fc9ef52
5
5
  SHA512:
6
- metadata.gz: 72ec7653f4f2354fcfc08164da13cd525dd10fac021aa943769b356ab4ce1e2d11cc87919d565900724652593bbdbe0711fdcc3a9a83339f5d669762ac832465
7
- data.tar.gz: c39c6392690c13dbf2ffad4743bc3a1169492ca8f982549e4fe47bcc4ed09414da9a680df9c4aa0606c2b33545302101721a0643865c5fc3e227849bf480b909
6
+ metadata.gz: 213b9d5bf71d5a841cfcc72962a38be15caadab1cb95554249d746e09320354e372728a774d2d28bbfdcce6e97d57c9a98bcd55e0f15fc4c2cfb4f76d796382e
7
+ data.tar.gz: 1f79ed50a6babb2158ee0f6198aa7ccc9b6619adc9ed18d71a50c45f6b48f18a71d972de253a15d09176f99a104d2f9b5ba168237088beb8ba8d91af33f9feea
data/CHANGELOG.md CHANGED
@@ -85,3 +85,7 @@
85
85
  ## v0.3.3
86
86
 
87
87
  * Bugfix order notes
88
+
89
+ ## v0.3.4
90
+
91
+ * Added methods to create, update and destroy order notes
@@ -69,7 +69,34 @@ module Mercadolibre
69
69
  def get_order_notes(order_id)
70
70
  filters = { access_token: @access_token }
71
71
  results = get_request("/orders/#{order_id}/notes", filters)
72
- results[:body]['results'].map { |r| Mercadolibre::Entity::OrderNote.new(r) }
72
+
73
+ results[:body].first['results'].map { |r| Mercadolibre::Entity::OrderNote.new(r) }
74
+ end
75
+
76
+ def create_order_note(order_id, text)
77
+ payload = { note: text }.to_json
78
+
79
+ headers = { content_type: :json, accept: :json }
80
+
81
+ result = post_request("/orders/#{order_id}/notes?access_token=#{@access_token}", payload, headers)
82
+
83
+ Mercadolibre::Entity::OrderNote.new(result[:body]['note'])
84
+ end
85
+
86
+ def update_order_note(order_id, note_id, text)
87
+ payload = { note: text }.to_json
88
+
89
+ headers = { content_type: :json, accept: :json }
90
+
91
+ result = put_request("/orders/#{order_id}/notes/#{note_id}?access_token=#{@access_token}", payload, headers)
92
+
93
+ Mercadolibre::Entity::OrderNote.new(result[:body]['note'])
94
+ end
95
+
96
+ def delete_order_note(order_id, note_id)
97
+ result = delete_request("/orders/#{order_id}/notes/#{note_id}?access_token=#{@access_token}")
98
+
99
+ result[:status_code] == 200
73
100
  end
74
101
 
75
102
  def get_order_feedbacks(order_id)
@@ -1,3 +1,3 @@
1
1
  module Mercadolibre
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercadolibre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler