parseapi 1.9.1 → 1.9.3
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 +3 -1
- data/lib/parseapi/client.rb +6 -1
- data/lib/parseapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 645ae90d9f3d07bce20b3b674c484c125455c0eb59ffb9b53d60b2f91f534345
|
|
4
|
+
data.tar.gz: e0abb6505d9d74b82d65319d851e0c025776f71e45d7b8dbd8bc114f6e1f75df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50f152ec92980405a45c0885f4c77830f95eaf4c5785047992463dbc56a448c2adb8c720b378465136434d8672178c7081c69ce56446baca6631bf7b05a3ded1
|
|
7
|
+
data.tar.gz: 225a706fa638520715044d6eb31b0cb3dea107a525bfe1de5eaecb0f23f5ed310202d1996b3eff15981d318431e3021a22d65844fdbf31ecd3d80c768a1cb90e
|
data/README.md
CHANGED
|
@@ -228,6 +228,8 @@ units = parse.measure_units(unit: 'm')
|
|
|
228
228
|
|
|
229
229
|
`amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
|
|
230
230
|
|
|
231
|
+
Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available.
|
|
232
|
+
|
|
231
233
|
Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
|
|
232
234
|
|
|
233
235
|
## Place statistics and optional detail
|
|
@@ -255,7 +257,7 @@ parse.weather(40.7128, -74.006, deep: true, date: '2026-08-15')
|
|
|
255
257
|
|
|
256
258
|
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.
|
|
257
259
|
|
|
258
|
-
Tariff lookup and search accept
|
|
260
|
+
Tariff lookup and search accept the `edition` ID returned by Tariff, such as `ted_3`, and an optional `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.
|
|
259
261
|
|
|
260
262
|
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.
|
|
261
263
|
|
data/lib/parseapi/client.rb
CHANGED
|
@@ -433,6 +433,7 @@ module ParseAPI
|
|
|
433
433
|
|
|
434
434
|
# Parse or convert a measurement. Amount is a decimal string. Without to, use the
|
|
435
435
|
# type's canonical unit. Locale and system (us or imperial) resolve explicit ambiguity.
|
|
436
|
+
# Successful JSON omits reason and choices. Invalid input adds reason and alternatives add choices.
|
|
436
437
|
def measure(measure, to: nil, locale: nil, system: nil)
|
|
437
438
|
get("/measure/#{seg(measure)}", to: to, locale: locale, system: system)
|
|
438
439
|
end
|
|
@@ -464,8 +465,12 @@ module ParseAPI
|
|
|
464
465
|
targets.join(',')
|
|
465
466
|
end
|
|
466
467
|
|
|
468
|
+
def tariff_edition_id?(value)
|
|
469
|
+
value.is_a?(String) && (/\A[a-f0-9]{64}\z/.match?(value) || (/\Ated_[1-9][0-9]{0,19}\z/.match?(value) && (value.bytesize < 24 || value[4..-1] <= '18446744073709551615')))
|
|
470
|
+
end
|
|
471
|
+
|
|
467
472
|
def tariff_selection(result, edition, date)
|
|
468
|
-
if (!edition.nil? || !date.nil?) && (!
|
|
473
|
+
if (!edition.nil? || !date.nil?) && (!tariff_edition_id?(result['edition']) || (!edition.nil? && result['edition'] != edition) || result['date'] != date)
|
|
469
474
|
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.')
|
|
470
475
|
end
|
|
471
476
|
result
|
data/lib/parseapi/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: parseapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ParseAPI
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|