parseapi 1.6.0 → 1.7.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/README.md +7 -1
- data/lib/parseapi/client.rb +12 -4
- data/lib/parseapi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6598fb8f4a05494418599738f387ab8137099ddb12ac09f63ca42410d6b4b89
|
|
4
|
+
data.tar.gz: 9de6f2540a617508c1c9a298361db8218e5f0460fb4a03e1e2c04a85179badca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2599c0832bed2f4306ac4f1b5eb31a2d4757546a7349178a8c7bd693605ee091b107cec97c2005d0ed002afa9e2758f0b22d86c679fd15efffad1bd6fa0453d4
|
|
7
|
+
data.tar.gz: 3d6a7f151089a85c0e76624f84cdd788df87a329371669505efd3179ec98c682017248e969072949f3975c70687ae4d9dfc766fec0949211df22a89374c80533
|
data/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Get a key at [parseapi.com](https://parseapi.com). The client also reads `PARSEA
|
|
|
13
13
|
|
|
14
14
|
## API versions
|
|
15
15
|
|
|
16
|
-
Version 1.
|
|
16
|
+
Version 1.7.0 explicitly selects the API contract supported by this SDK. It sends `Parse-Version: 2.0.0` on every lookup so responses match the API contract supported by the package. Your key and the team's saved default stay the same.
|
|
17
17
|
|
|
18
18
|
Upgrade the dependency in staging, review the [release notes](https://parseapi.com/docs/releases), and test the application before deploying the same code and dependency version to production. Commit your dependency lockfile so the tested package travels with your deployment. Future major SDK upgrades can select a newer API contract.
|
|
19
19
|
|
|
@@ -219,6 +219,12 @@ parse.weather(40.7128, -74.006, deep: true, date: '2026-08-15')
|
|
|
219
219
|
|
|
220
220
|
Tariff starts with the general schedule line. Paid deep adds units and the special and other schedule columns. An optional origin then resolves country-specific measures. The three calls below show those successive choices. Without origin, schedule detail is still returned and origin-dependent fields are null. A null effective rate is not a zero rate.
|
|
221
221
|
|
|
222
|
+
Tariff lookup and search accept an optional `edition` fingerprint and `date` (`YYYY-MM-DD`). The edition pins exact immutable source bytes. A date is accepted only when verified source coverage exists. An edition without a date returns undated schedule context (`date: null`). Default requests use today. Paid detail exposes an open-string `reason` when `effective_rate` is null, including `incomplete_coverage`. A null rate never means zero. Explicit selections fail with `tariff_selection_mismatch` if an older server ignores the requested scope.
|
|
223
|
+
|
|
224
|
+
Origin means where the goods originate, not where they ship from. The effective rate covers matched stored schedule measures only. It is not complete duty or landed cost.
|
|
225
|
+
|
|
226
|
+
Codes contain 4, 6, 8 or 10 ASCII digits; dots and whitespace are optional. Search returns up to 20 description matches with parent `lineage` so a result named "Other" has context. Search is not product classification. In deep, `measures: null` means origin-dependent measures were not resolved. `measures: []` means the resolved lookup found none.
|
|
227
|
+
|
|
222
228
|
```ruby
|
|
223
229
|
parse.tariff('8471.30.01.00')
|
|
224
230
|
parse.tariff('8471.30.01.00', deep: true)
|
data/lib/parseapi/client.rb
CHANGED
|
@@ -258,12 +258,12 @@ module ParseAPI
|
|
|
258
258
|
# schedule columns. Add origin with deep to resolve country-specific measures. Without origin,
|
|
259
259
|
# schedule detail remains available and origin-dependent fields are null. A null effective rate
|
|
260
260
|
# is not a zero rate.
|
|
261
|
-
def tariff(code, deep: false, origin: nil)
|
|
262
|
-
get("/tariff/#{seg(code)}", deep: deep, origin: origin)
|
|
261
|
+
def tariff(code, deep: false, origin: nil, edition: nil, date: nil)
|
|
262
|
+
tariff_selection(get("/tariff/#{seg(code)}", deep: deep, origin: origin, edition: edition, date: date), edition, date)
|
|
263
263
|
end
|
|
264
264
|
|
|
265
|
-
def tariff_search(query)
|
|
266
|
-
get('/tariff', q: query)
|
|
265
|
+
def tariff_search(query, edition: nil, date: nil)
|
|
266
|
+
tariff_selection(get('/tariff', q: query, edition: edition, date: date), edition, date)
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
def currency(code, deep: false, lang: nil)
|
|
@@ -381,6 +381,14 @@ module ParseAPI
|
|
|
381
381
|
targets.join(',')
|
|
382
382
|
end
|
|
383
383
|
|
|
384
|
+
def tariff_selection(result, edition, date)
|
|
385
|
+
if (!edition.nil? || !date.nil?) && (!result['edition'].is_a?(String) || !/\A[a-f0-9]{64}\z/.match?(result['edition']) || (!edition.nil? && result['edition'] != edition) || result['date'] != date)
|
|
386
|
+
raise Error.new(status: 0, code: 'tariff_selection_mismatch', message: 'Tariff response did not confirm the requested edition/date. The server may not support this selection.')
|
|
387
|
+
end
|
|
388
|
+
result
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
|
|
384
392
|
def seg(value)
|
|
385
393
|
URI.encode_www_form_component(value.to_s).gsub('+', '%20')
|
|
386
394
|
end
|
data/lib/parseapi/version.rb
CHANGED