mercado_livre_api 0.2.0 → 0.3.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 +12 -0
- data/lib/mercado_livre_api/client.rb +19 -3
- data/lib/mercado_livre_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae63147281b2f563edf461ba04aaa557e07b0c50a9b6f35844addee298afcd31
|
|
4
|
+
data.tar.gz: bf01b7f05744c232a88f1945f14528223d22482fdf27c70903b0895d6c9caa18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 341668c8102f8f7c65f50b9acbaf2135a5888b39077314a4cabd5b3f3090218c4c26eef9cc572c67958068db162e2f7e613a7e0fa0d94113f81b4fdc2c58ac92
|
|
7
|
+
data.tar.gz: c4cda89691075cb5b0cd456d1d9cde8883c88e58e6eeaee7b42a5c67a9ef86f0eefec8e434591914841fbfb9d22e1bb2f09bffac231222c12f6315a1ff1fb557
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.3.0] - 2026-11-25
|
|
4
|
+
|
|
5
|
+
- `multiget` now uses the `/items/bulk` endpoint. **Breaking:** each entry is now
|
|
6
|
+
`{id, status_code, body}` — `code` was renamed to `status_code`. Failed entries
|
|
7
|
+
(e.g. 404) have no `body`; the message is in `error.message` instead of
|
|
8
|
+
`body.message`. Results follow the order of the requested ids.
|
|
9
|
+
- `multiget` makes a single request and raises `ArgumentError` for more than
|
|
10
|
+
20 ids (`MULTIGET_MAX_IDS`, the API limit): splitting into batches is up to
|
|
11
|
+
the caller. It returns `[]` for an empty `ids` list instead of hitting the API.
|
|
12
|
+
- `multiget` accepts `include_attributes: true`, which sends `include_attributes=all`
|
|
13
|
+
so each variation comes with its `attributes` (e.g. `SELLER_SKU`).
|
|
14
|
+
|
|
3
15
|
## [0.1.0] - 2026-08-17
|
|
4
16
|
|
|
5
17
|
- Initial release
|
|
@@ -153,10 +153,26 @@ module MercadoLivreApi
|
|
|
153
153
|
get("/users/#{user_id}/items/search", params: params) { _1.results.is_a?(Array) }
|
|
154
154
|
end
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
MULTIGET_MAX_IDS = 20
|
|
157
|
+
|
|
158
|
+
# Uma requisição por chamada: dividir mais de MULTIGET_MAX_IDS ids em lotes
|
|
159
|
+
# fica com quem chama (que controla quantas requisições faz).
|
|
160
|
+
#
|
|
161
|
+
# @param ids [Array<String>] até MULTIGET_MAX_IDS ids de anúncio
|
|
162
|
+
# @param include_attributes [Boolean] true envia include_attributes=all, que a
|
|
163
|
+
# API exige para trazer os atributos (ex: SELLER_SKU) dentro de cada variação
|
|
164
|
+
# @raise [ArgumentError] com mais de MULTIGET_MAX_IDS ids
|
|
165
|
+
def multiget(ids: [], attributes: nil, include_attributes: false)
|
|
166
|
+
return [] if ids.blank?
|
|
167
|
+
if ids.size > MULTIGET_MAX_IDS
|
|
168
|
+
raise ArgumentError, "multiget aceita até #{MULTIGET_MAX_IDS} ids por requisição (recebeu #{ids.size})"
|
|
169
|
+
end
|
|
170
|
+
|
|
157
171
|
params = {ids: ids.join(",")}
|
|
158
|
-
params[:attributes] = attributes.join(",") if attributes
|
|
159
|
-
|
|
172
|
+
params[:attributes] = (%w[id status_code error] + attributes.map { "body.#{_1}" }).join(",") if attributes.present?
|
|
173
|
+
params[:include_attributes] = "all" if include_attributes
|
|
174
|
+
|
|
175
|
+
get("/items/bulk", params: params) { _1.is_a?(Array) }
|
|
160
176
|
end
|
|
161
177
|
|
|
162
178
|
def get_listing(item_id)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mercado_livre_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- marialuiza1324
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: ac
|
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '0'
|
|
61
61
|
requirements: []
|
|
62
|
-
rubygems_version: 3.6.
|
|
62
|
+
rubygems_version: 3.6.9
|
|
63
63
|
specification_version: 4
|
|
64
64
|
summary: Ruby client for the Mercado Livre — OAuth authentication and endpoints for
|
|
65
65
|
orders, shipments, shipping labels and invoices.
|