mercado_livre_api 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4c78b8b5d387198744fca75d8c77d372bde101b2c1a5d6117ee3b7d56e3d4cc
4
- data.tar.gz: 74a9a1fe28494f6525ff0210b2dc0cde0682e97fe9f85c1fe0b3f7e9afa6545a
3
+ metadata.gz: da2e5a6e2092109d60552f33315b0587ea517826698694261992040894b4150d
4
+ data.tar.gz: a4ed7d00baaca1ea57d779c85e84926f4f446998d703e67816cb32f72d35da48
5
5
  SHA512:
6
- metadata.gz: 31cd6e0091c48a92d84e75b15692167d4893f7ef29de0fd6370a6b572c383b687b7477f05affbe59dca10e80936acb15c4000dcb098b8d221c3e790924a1b630
7
- data.tar.gz: e1dc377c3fac7093308805d22a511de11fc1c05cb43847bb3097a700e3516e30bd734e74275579b35ce8ec4afc4e5138417241463e1a6bfa543adbaa0b280abb
6
+ metadata.gz: d234e0a23fabc62515d879e73187c51a22c853c58a02eb695f7fce35fff0d2826d925b432dc0ab9e75ce9af45becf19e45cb98ffeb9eeec2750164d2296523cf
7
+ data.tar.gz: 4f8a767ae05fdba58ae0ec79c904784f32512b541cb2d851ea713f8dabf61ec36f8fda70cf37478ed87247916cea6a1910ded88368bc4055b5038a2e16b9501d
@@ -145,5 +145,114 @@ module MercadoLivreApi
145
145
  def get_pack(pack_id)
146
146
  get("/packs/#{pack_id}") { _1.id }
147
147
  end
148
+
149
+ def get_listings(scroll_id: nil, limit: 100)
150
+ params = {search_type: "scan", limit: limit}
151
+ params[:scroll_id] = scroll_id if scroll_id.present?
152
+
153
+ get("/users/#{user_id}/items/search", params: params) { _1.results.is_a?(Array) }
154
+ end
155
+
156
+ def multiget(ids: [], attributes: nil)
157
+ params = {ids: ids.join(",")}
158
+ params[:attributes] = attributes.join(",") if attributes
159
+ get("/items", params: params) { _1.is_a?(Array) }
160
+ end
161
+
162
+ def get_listing(item_id)
163
+ get("/items/#{item_id}?include_attributes=all") { _1.id }
164
+ end
165
+
166
+ def get_listing_description(item_id)
167
+ get("/items/#{item_id}/description") { _1.plain_text }
168
+ end
169
+
170
+ def get_listing_variations(item_id)
171
+ get("/items/#{item_id}/variations?include_attributes=all") { _1.is_a?(Array) }
172
+ end
173
+
174
+ # @param dimensions [String] Dimensões do item (altura x largura x comprimento e peso). Exemplo: 60x364x63,661
175
+ def get_listing_shipping_cost(
176
+ item_id:,
177
+ dimensions: nil,
178
+ item_price: nil,
179
+ verbose: true,
180
+ mode: nil,
181
+ logistic_type: nil,
182
+ free_shipping: nil
183
+ )
184
+ params = {
185
+ item_id: item_id,
186
+ dimensions: dimensions,
187
+ item_price: item_price,
188
+ verbose: verbose,
189
+ mode: mode,
190
+ logistic_type: logistic_type,
191
+ free_shipping: free_shipping
192
+ }.compact
193
+ get("/users/#{user_id}/shipping_options/free", params: params)
194
+ end
195
+
196
+ def update_stock(item_id:, quantity:)
197
+ body = { available_quantity: quantity }
198
+ put("/items/#{item_id}", body: body)
199
+ end
200
+
201
+ def update_price(item_id:, price:)
202
+ body = { price: price }
203
+ put("/items/#{item_id}", body: body)
204
+ end
205
+
206
+ def update_variation_stock(item_id:, variation_id:, quantity:)
207
+ body = {
208
+ variations: [
209
+ id: variation_id,
210
+ available_quantity: quantity
211
+ ]
212
+ }
213
+ put("/items/#{item_id}", body: body)
214
+ end
215
+
216
+ def update_variation_price(item_id:, variation_id:, price:)
217
+ body = {
218
+ variations: [
219
+ id: variation_id,
220
+ price: price
221
+ ]
222
+ }
223
+ put("/items/#{item_id}", body: body)
224
+ end
225
+
226
+ def close_listing(item_id)
227
+ put("/items/#{item_id}", body: { status: "closed" })
228
+ end
229
+
230
+ def relist(item_id:, price:, quantity:, listing_type:)
231
+ body = {
232
+ price: price,
233
+ quantity: quantity,
234
+ listing_type_id: listing_type
235
+ }.compact
236
+ post("/items/#{item_id}/relist", body: body)
237
+ end
238
+
239
+ def get_all_categories
240
+ get("/sites/MLB/categories/all", accept_encoding: "gzip")
241
+ end
242
+
243
+ def get_category_rates(category_id:, price: 1000)
244
+ get("/sites/MLB/listing_prices?category_id=#{category_id}&price=#{price}") { _1.is_a?(Array) }
245
+ end
246
+
247
+ private
248
+
249
+ def user_id
250
+ @user_id || fetch_user_id
251
+ end
252
+
253
+ def fetch_user_id
254
+ response = get("/users/me") { _1.id }
255
+ @user_id = response.id
256
+ end
148
257
  end
149
258
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MercadoLivreApi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercado_livre_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - marialuiza1324
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-10-28 00:00:00.000000000 Z
10
+ date: 2026-10-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ac
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- description:
28
26
  email:
29
27
  - marialuiza.nerypinto@yahoo.com.br
30
28
  executables: []
@@ -47,7 +45,6 @@ metadata:
47
45
  homepage_uri: https://github.com/todasessascoisas/mercado_livre_api
48
46
  source_code_uri: https://github.com/todasessascoisas/mercado_livre_api
49
47
  changelog_uri: https://github.com/todasessascoisas/mercado_livre_api
50
- post_install_message:
51
48
  rdoc_options: []
52
49
  require_paths:
53
50
  - lib
@@ -62,8 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
59
  - !ruby/object:Gem::Version
63
60
  version: '0'
64
61
  requirements: []
65
- rubygems_version: 3.5.3
66
- signing_key:
62
+ rubygems_version: 3.6.2
67
63
  specification_version: 4
68
64
  summary: Ruby client for the Mercado Livre — OAuth authentication and endpoints for
69
65
  orders, shipments, shipping labels and invoices.