mercadolibre 0.8.7 → 0.9.0

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: e784e247683361b50f2ec3bb62e51a85b3020a0d
4
- data.tar.gz: 34315bbdec5360e28b88289bb78025e5503736f4
3
+ metadata.gz: f2bce71fe7071b4e96bef15c458d89299f4e6611
4
+ data.tar.gz: 06642804da258198aae2cf227cfae111148092aa
5
5
  SHA512:
6
- metadata.gz: ac402fecadc330e2e3016c1f03526c1c73ab45ea140741347cba41812560a5ae292b1dee1bfd4737b977981264a051ab8fef8ead65cf9306c5884bc097e59c66
7
- data.tar.gz: 1f3ade83b7ebeae285eb2bdcfb44db0fc9b7da98edb8ed13d7289ac901c465e0594dda0b8a29d4af2ee56c303bdb98f6bd01b9659e89132879ac22e82d7c4b93
6
+ metadata.gz: f1f86f4b6e25af563ce65828cd1b2b9ac2c8bcee0a0487b99cb308a5cc993a223f3ab72053d017d5eb6c8ab5c498a77eb808695f3dd81329b8c2dcd92835c337
7
+ data.tar.gz: e78996c67262ddbc5f1cfa3d1ed1ccc21dda43cc31a15e5df6e310bda4ee0cb4d0ac5972a397b05aff2c70076761eaa5628df5be223073f790f739fceb769dde
data/CHANGELOG.md CHANGED
@@ -165,3 +165,7 @@
165
165
  ## v0.8.7
166
166
 
167
167
  * Bugfix on method to get item description
168
+
169
+ ## v0.9.0
170
+
171
+ * Manage items metadata
data/lib/mercadolibre.rb CHANGED
@@ -22,6 +22,7 @@ require "mercadolibre/entity/feedback"
22
22
  require "mercadolibre/entity/feedback_reply"
23
23
  require "mercadolibre/entity/geolocation"
24
24
  require "mercadolibre/entity/item"
25
+ require "mercadolibre/entity/item_attribute"
25
26
  require "mercadolibre/entity/item_description"
26
27
  require "mercadolibre/entity/item_payment_method"
27
28
  require "mercadolibre/entity/item_picture"
@@ -214,6 +214,31 @@ module Mercadolibre
214
214
 
215
215
  post_request("/items/#{item_id}/descriptions?access_token=#{@access_token}", payload, headers)[:body]
216
216
  end
217
+
218
+ def update_item_attributes(item_id, attrs)
219
+ payload = attrs.to_json
220
+
221
+ headers = { content_type: :json, accept: :json }
222
+
223
+ put_request("/items/#{item_id}?access_token=#{@access_token}", payload, headers)[:body]
224
+
225
+ end
226
+
227
+ def delete_item_attributes(item_id, attr_list)
228
+ payload = attr_list.map { |x| { id: x } }.to_json
229
+
230
+ headers = { content_type: :json, accept: :json }
231
+
232
+ put_request("/items/#{item_id}?access_token=#{@access_token}", payload, headers)[:body]
233
+ end
234
+
235
+ def update_item_identifiers(item_id, attrs)
236
+ payload = attrs.to_json
237
+
238
+ headers = { content_type: :json }
239
+
240
+ put_request("/items/#{item_id}/product_identifiers?access_token=#{@access_token}", payload, headers)[:body]
241
+ end
217
242
  end
218
243
  end
219
244
  end
@@ -29,6 +29,8 @@ module Mercadolibre
29
29
  self.seller_address = Address.new(v)
30
30
  elsif k.to_s == 'geolocation'
31
31
  self.geolocation = Geolocation.new(v)
32
+ elsif k.to_s == 'attributes'
33
+ self.geolocation = v.map { |x| ItemAttribute.new(x) } unless v.nil?
32
34
  elsif k.to_s == 'seller'
33
35
  self.seller = User.new(v)
34
36
 
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class ItemAttribute
4
+ def self.attr_list
5
+ [:id, :name, :value_id, :value_name, :attribute_group_id, :attribute_group_name]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ self.send("#{k}=", v) if self.respond_to?(k)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ attr_writer *attr_list
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Mercadolibre
2
- VERSION = "0.8.7"
2
+ VERSION = "0.9.0"
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.8.7
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,6 +93,7 @@ files:
93
93
  - lib/mercadolibre/entity/feedback_reply.rb
94
94
  - lib/mercadolibre/entity/geolocation.rb
95
95
  - lib/mercadolibre/entity/item.rb
96
+ - lib/mercadolibre/entity/item_attribute.rb
96
97
  - lib/mercadolibre/entity/item_description.rb
97
98
  - lib/mercadolibre/entity/item_payment_method.rb
98
99
  - lib/mercadolibre/entity/item_picture.rb