mercadolibre 0.9.0 → 0.9.1

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: f2bce71fe7071b4e96bef15c458d89299f4e6611
4
- data.tar.gz: 06642804da258198aae2cf227cfae111148092aa
3
+ metadata.gz: 36ceb4c297a1521ba86c8c2f6f9e19f9da804f18
4
+ data.tar.gz: 5007a65e2055bb6f1449bfec86840eb192481030
5
5
  SHA512:
6
- metadata.gz: f1f86f4b6e25af563ce65828cd1b2b9ac2c8bcee0a0487b99cb308a5cc993a223f3ab72053d017d5eb6c8ab5c498a77eb808695f3dd81329b8c2dcd92835c337
7
- data.tar.gz: e78996c67262ddbc5f1cfa3d1ed1ccc21dda43cc31a15e5df6e310bda4ee0cb4d0ac5972a397b05aff2c70076761eaa5628df5be223073f790f739fceb769dde
6
+ metadata.gz: 7536a97e19f81a894f3db3e8c5ccd456bf2b0aad8650bca1050d1cdd50e63f1c7f9baa80ed9e555cb0fe66843904d886baee6517d55f36362e3a8a304a85ce34
7
+ data.tar.gz: 87b61b91afa6e38219e5c24c091b542a017829fa689c1442d2ffa16fba45c800946871043517d0c9019ada7406784cd1247b9cc2b4e1bd7e1d96ff774e115a0e
data/CHANGELOG.md CHANGED
@@ -169,3 +169,7 @@
169
169
  ## v0.9.0
170
170
 
171
171
  * Manage items metadata
172
+
173
+ ## v0.9.1
174
+
175
+ * Added method to get item identifiers
@@ -239,6 +239,12 @@ module Mercadolibre
239
239
 
240
240
  put_request("/items/#{item_id}/product_identifiers?access_token=#{@access_token}", payload, headers)[:body]
241
241
  end
242
+
243
+ def get_item_identifiers(item_id)
244
+ result = get_request("/items/#{item_id}/product_identifiers")
245
+
246
+ Mercadolibre::Entity::ProductIdentifier.new(result[:body])
247
+ end
242
248
  end
243
249
  end
244
250
  end
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class Gtin
4
+ def self.attr_list
5
+ [:type, :code]
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
@@ -0,0 +1,25 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class ProductIdentifier
4
+ def self.attr_list
5
+ [:brand, :mpn, :gtins]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ if k.to_s == 'gtins'
13
+ self.gtins = v.map { |x| Gtin.new(x) } unless v.nil?
14
+ else
15
+ self.send("#{k}=", v) if self.respond_to?(k)
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ attr_writer *attr_list
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Mercadolibre
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
data/lib/mercadolibre.rb CHANGED
@@ -21,6 +21,7 @@ require "mercadolibre/entity/featured_item"
21
21
  require "mercadolibre/entity/feedback"
22
22
  require "mercadolibre/entity/feedback_reply"
23
23
  require "mercadolibre/entity/geolocation"
24
+ require "mercadolibre/entity/gtin"
24
25
  require "mercadolibre/entity/item"
25
26
  require "mercadolibre/entity/item_attribute"
26
27
  require "mercadolibre/entity/item_description"
@@ -45,6 +46,7 @@ require "mercadolibre/entity/payment_method"
45
46
  require "mercadolibre/entity/payment_plan"
46
47
  require "mercadolibre/entity/payment_promotion"
47
48
  require "mercadolibre/entity/phone"
49
+ require "mercadolibre/entity/product_identifier"
48
50
  require "mercadolibre/entity/question"
49
51
  require "mercadolibre/entity/search_location"
50
52
  require "mercadolibre/entity/shipment"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercadolibre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
@@ -92,6 +92,7 @@ files:
92
92
  - lib/mercadolibre/entity/feedback.rb
93
93
  - lib/mercadolibre/entity/feedback_reply.rb
94
94
  - lib/mercadolibre/entity/geolocation.rb
95
+ - lib/mercadolibre/entity/gtin.rb
95
96
  - lib/mercadolibre/entity/item.rb
96
97
  - lib/mercadolibre/entity/item_attribute.rb
97
98
  - lib/mercadolibre/entity/item_description.rb
@@ -116,6 +117,7 @@ files:
116
117
  - lib/mercadolibre/entity/payment_plan.rb
117
118
  - lib/mercadolibre/entity/payment_promotion.rb
118
119
  - lib/mercadolibre/entity/phone.rb
120
+ - lib/mercadolibre/entity/product_identifier.rb
119
121
  - lib/mercadolibre/entity/question.rb
120
122
  - lib/mercadolibre/entity/search_location.rb
121
123
  - lib/mercadolibre/entity/shipment.rb