mercadolibre 0.8.7 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/mercadolibre.rb +1 -0
- data/lib/mercadolibre/core/items_and_searches.rb +25 -0
- data/lib/mercadolibre/entity/item.rb +2 -0
- data/lib/mercadolibre/entity/item_attribute.rb +21 -0
- data/lib/mercadolibre/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2bce71fe7071b4e96bef15c458d89299f4e6611
|
4
|
+
data.tar.gz: 06642804da258198aae2cf227cfae111148092aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f86f4b6e25af563ce65828cd1b2b9ac2c8bcee0a0487b99cb308a5cc993a223f3ab72053d017d5eb6c8ab5c498a77eb808695f3dd81329b8c2dcd92835c337
|
7
|
+
data.tar.gz: e78996c67262ddbc5f1cfa3d1ed1ccc21dda43cc31a15e5df6e310bda4ee0cb4d0ac5972a397b05aff2c70076761eaa5628df5be223073f790f739fceb769dde
|
data/CHANGELOG.md
CHANGED
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
|
data/lib/mercadolibre/version.rb
CHANGED
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.
|
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-
|
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
|