parseapi 0.3.0 → 0.4.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: b2316d235b18d38725e7d0dfed6bca9555cdcf671a08a0a8dc8efe07c58e9166
4
- data.tar.gz: 9341ee6037d564104d8f902f2d3b77165d3b1af5f16df19ec64e8a4e80339066
3
+ metadata.gz: fae571978d7957f72ae69536a6d4c72e80ba58e7228acb0089e1344e54b8a0cf
4
+ data.tar.gz: 41bd5c285c7ec8c138f00d37a1378d61ece08374cc0df6a933ba41c9f457db11
5
5
  SHA512:
6
- metadata.gz: 817f1db4689938cf40414e442ce19e2416bf28a95f9622ba04644c05b3cfe59ea1b3c4368ceadf65cda9184433993b6c7aa4382de07e415c051e270edef36df8
7
- data.tar.gz: '08e78eef996d017c22b18767461cc25468853e4cb823331a1ab093de2c1cf63409f344e54c23bb20c59a3a76c9e1f618073333875af7623249db63526ff47866'
6
+ metadata.gz: 394f8262c936d35b38f9947b8a41818bcc29bdb99fb3dfb348830c021f5e3be92ab9556b74262917598ef028d608be498c150f8574c2f8a266f6281d09d1240d
7
+ data.tar.gz: 01d9c5a27c4a415f061ce707992a5b277fe522e6b0fb01eda56aa6910d728908dc4f3cfa209cad20f30c174714c5619acac38202f6022a13793d210921cab2f1
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 parseAPI
3
+ Copyright (c) 2026 ParseAPI
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -11,6 +11,37 @@ country = parse.country('US')
11
11
 
12
12
  Get a key at [parseapi.com](https://parseapi.com). The client also reads `PARSEAPI_KEY` from the environment.
13
13
 
14
+ ## API versions
15
+
16
+ Choose your team's API version in [Dashboard → API version](https://parseapi.com/dashboard/versions). One setting applies to every key, including new and replacement keys. Existing teams keep `1.0.0`; new teams start on `2.0.0`. Keep the same keys and lookup URLs. Installing or upgrading the package does not change the team's setting.
17
+
18
+ Published SDK `0.3.2` matches API `1.0.0`. The examples and response types in this source tree target API `2.0.0`, including changes that are not in `0.3.2`. Use a package release documented for your team's version. These types do not model every historical response; moving to `2.0.0` may require updating code that reads renamed, moved or removed fields.
19
+
20
+ Test the target contract in a separate development team before changing your production team's version. A change applies to every integration in that team. See [API versions and migration](https://parseapi.com/docs/versioning).
21
+
22
+ ## Weather from a postal code
23
+
24
+ Start with the postal code, then pass its coordinates to weather. Reuse the client from the example above.
25
+
26
+ ```ruby
27
+ place = parse.postal('28202', country: 'US')
28
+ lat, lon = place.values_at('latitude', 'longitude')
29
+ unless lat.nil? || lon.nil?
30
+ weather = parse.weather(lat, lon)
31
+ puts weather
32
+ end
33
+ ```
34
+
35
+ The coordinates represent the postal area. Weather is for that point. Missing coordinates skip the weather lookup. This composition performs two ordinary lookups when coordinates are available, with the retry policy below.
36
+
37
+ ## Supply the context you know
38
+
39
+ Pass `country` when a postal code or national phone number needs disambiguation. A complete international phone number already carries its country context. For a numeric date such as `03/04/2026`, supply the intended `format`. Defaults resolve what the input establishes. Ambiguous input needs your context.
40
+
41
+ Results are plain data. Pass a returned code or coordinate to another operation when the task needs it. Check nullable values before composing the next call.
42
+
43
+ Use `parse.postal('28202', country: 'US', deep: true)` for US ZIP tax references. `deep.tax` names the levy and `deep.tax_rate` is a percentage, so `7.9` means 7.9%. The state, county, city and special components explain that combined rate. An exact address can differ. Country and state lookups provide their own geographic reference rates, which should not be added to the ZIP rate. `nil` means unknown and `0` means known zero. Country `deep.tax_id_format` and `deep.tax_id_regex` describe registration-number format only. Use `vat` for a metered registration check with `deep` explicitly enabled.
44
+
14
45
  ## Calls
15
46
 
16
47
  One method per endpoint, named after the route.
@@ -21,6 +52,7 @@ parse.ip_self
21
52
  parse.email('hello@gmail.com')
22
53
  parse.vat('DE136695976')
23
54
  parse.iban('DE89370400440532013000')
55
+ parse.bin('424242')
24
56
  parse.npi('1881018208')
25
57
  parse.phone('+14155552671')
26
58
  parse.carrier('+14155552671')
@@ -52,9 +84,11 @@ parse.currency('USD')
52
84
  parse.currency_rate('USD', 'EUR')
53
85
  parse.language('en')
54
86
  parse.name('BILLY OSHALL')
55
- parse.timezone('America/New_York')
56
- parse.timezone('America/New_York', at: '2026-09-05T15:00', to: 'Europe/London')
57
- parse.timezone_at(35.2271, -80.8431)
87
+ parse.name('Andrea', country: 'IT', deep: true)
88
+ parse.time # UTC now
89
+ parse.time('America/New_York')
90
+ parse.time('America/New_York', at: '2026-09-05T15:00', to: 'Europe/London')
91
+ parse.time_at(35.2271, -80.8431)
58
92
  parse.date('03/04/2026', format: 'mdy')
59
93
  parse.date_today(to: '2026-12-25')
60
94
  parse.holiday('US', year: 2026)
@@ -67,23 +101,94 @@ parse.domain('example.com')
67
101
  parse.asn('AS13335')
68
102
  parse.mac('00:1B:63:84:45:E6')
69
103
  parse.mx('example.com')
104
+ parse.dns('example.com')
105
+ parse.dns('_dmarc.example.com', type: 'TXT')
70
106
  parse.useragent(ua_string)
71
107
  parse.vin('1HGCM82633A004352')
108
+ parse.naics('541511')
109
+ parse.naics_search('coffee shop', limit: 5)
72
110
  parse.tariff('8471.30.01.00', origin: 'CN', deep: true)
73
111
  parse.tariff_search('sunglasses')
74
112
  parse.emoji('rocket')
75
113
  parse.emoji_search('fire')
76
114
  ```
77
115
 
116
+ NAICS paid deep records include classification `deep.exclusions`, each with a description and linked codes. Generic exclusions can have no linked codes. Omitted or null exclusions in older responses remain unknown. Search results also include `match`: the matched `field` (`name`, `term` or `naics`) and `text`, plus `corrections` with `from` and `to` tokens for typo fallback. Corrections are empty for exact, plural and prefix matches. Direct code lookups omit `match`. Older responses may omit it.
117
+
78
118
  Each lookup returns a plain hash with string keys. Related lookups are separate calls, such as `country_states('US')`. Reading the result makes no further requests. New response fields and `nil` values are preserved.
79
119
 
120
+ DNS uses pooled requests on every plan. Omit `type` to check A, AAAA, CNAME, MX, NS, TXT, SOA, CAA, SRV and PTR. Records contain `name`, `type`, `ttl` in seconds and a DNS presentation `value`. TXT values retain quoting and chunk boundaries. A selected question can include its CNAME chain. Empty records mean no records. Lookup failures remain errors.
121
+
122
+ ## Time
123
+
124
+ `time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
125
+
126
+ ## Measurements
127
+
128
+ ```ruby
129
+ result = parse.measure('5 ft 11 in', to: 'cm')
130
+ units = parse.measure_units(unit: 'm')
131
+ ```
132
+
133
+ `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.
134
+
135
+ 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.
136
+
137
+ ## Place statistics and optional detail
138
+
139
+ Postal and District paid profiles include `deep.property_tax` where supported. It contains `annual_median`, `currency` and `period`: median annual property tax payable on owner-occupied homes in the statistical area. The amount is adjusted to the final year of the reporting period (`YYYY-YYYY`). This is an area statistic, not a rate or an individual property bill. Unsupported, missing and censored estimates are null.
140
+
141
+ ```ruby
142
+ place = parse.postal('28202', country: 'US', deep: true)
143
+ property_tax = place.dig('deep', 'property_tax')
144
+ ```
145
+
146
+ Read `population_period` alongside `population`: a reporting year (`YYYY`) or period (`YYYY-YYYY`), null when unknown or unverifiable. Keep missing or null values unknown and preserve a known zero. These fields belong to full place profiles. State district lists include each district's population and period. Postal nearby and distance detail remains metropolitan associations only. Continent population and its period remain in core.
147
+
148
+ Point returns the timezone ID with the core location. Its optional deep detail adds terrain and compact nearest-city context on every plan. A nearest city is null when none is within 200 km.
149
+
150
+ Weather returns current conditions by default. Paid deep adds specialist current measurements, forecasts and related detail. A past `date` is a UTC day and requires deep: it adds `deep.history` alongside current conditions. Date alone does not request history.
151
+
152
+ ```ruby
153
+ parse.weather(40.7128, -74.006, deep: true, date: '2026-08-15')
154
+ ```
155
+
156
+ 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.
157
+
158
+ ```ruby
159
+ parse.tariff('8471.30.01.00')
160
+ parse.tariff('8471.30.01.00', deep: true)
161
+ parse.tariff('8471.30.01.00', deep: true, origin: 'CN')
162
+ ```
163
+
164
+ Address search uses context from the form: prefer postal, or city and state. An optional end-user `ip` is a locality hint for server-side calls. An empty result explains itself with `reason`: `more_input`, `missing_context` or `no_matches`. With suggestions, reason is null. Older responses may omit it, and future reasons remain strings. Catalog and lookup failures use the existing API errors.
165
+
166
+ HLR reports status at the last check. `live` means assigned and `connected` means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep diagnostics stay within the same metered lookup.
167
+
80
168
  ## Deep
81
169
 
82
- Pass `deep: true` to include the nested `deep` object with richer fields.
170
+ Choose enrichment for the question you need answered.
171
+
172
+ | Operation | What `deep` requests |
173
+ |---|---|
174
+ | IP | Richer IP fields included with a paid plan. No separate check meter. |
175
+ | Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
176
+ | Email | A metered deliverability check, using included email checks or enabled on-demand usage. |
177
+ | VAT | A metered registry check where supported, using included VAT checks or enabled on-demand usage. |
178
+ | Phone, Time, Date, Currency, Language, Emoji, IBAN, Point | Optional detail in the same pooled request on every plan. |
179
+ | Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
180
+ | Name, NAICS | Name evidence or the industry definition profile on paid plans. |
181
+ | VIN, NPI, Tariff, Company | The complete product detail bag on paid plans. |
182
+ | Weather | Specialist current measurements and the existing forecast, alert, air and history bag on paid plans. |
183
+ | Carrier, HLR | Optional diagnostic detail within the same metered core unit, including Free allowance units. No second gate or additional check. |
184
+
185
+ Carrier, caller, and HLR are separate metered operations. Choose them explicitly when you need their answers. Ordinary lookups retry twice by default. Metered checks use one attempt by default. Setting retries explicitly can repeat paid usage.
186
+
187
+ Without `deep`, the response omits that key. When requested, it is an empty object if access is locked or the operation has no deep fields. Otherwise it contains the available fields. A missing or null field means unknown.
83
188
 
84
189
  ```ruby
85
190
  ip = parse.ip('52.94.76.10', deep: true)
86
- ip['deep']['datacenter'] # true
191
+ ip.dig('deep', 'datacenter') # true, false, or nil
87
192
  ```
88
193
 
89
194
  ## Errors
@@ -124,3 +229,16 @@ Requires Ruby 3.0 or later. Standard library only, zero dependencies.
124
229
  ## Docs
125
230
 
126
231
  Full field reference for every endpoint: [parseapi.com/docs](https://parseapi.com/docs)
232
+
233
+ BIN lookup accepts 6-11 digits as a string, including leading zeros. Spaces and hyphens are accepted. `prefix` is the actual longest match and can be shorter than the input. Unknown reference fields are null. `deep` adds an empty object on every plan.
234
+
235
+
236
+ ## Optional detail
237
+
238
+ The default response answers the common task. Ask for `deep` when you need more detail about that same result. Core fields stay equal. City, NAICS and Emoji searches put detail inside each result. Postal nearby and distance put metropolitan detail beside the entity it describes. Time conversion keeps target detail in `to.deep`; only the source has `deep.next_dst`.
239
+
240
+ ```ruby
241
+ basic = parse.time('America/New_York')
242
+ detail = parse.time('America/New_York', deep: true)
243
+ puts basic['at'], detail.dig('deep', 'next_dst')
244
+ ```
@@ -30,6 +30,7 @@ module ParseAPI
30
30
  ].freeze
31
31
 
32
32
  def initialize(api_key = nil, base_url: nil, timeout: nil, retries: nil, transport: nil)
33
+ # You found Dev. https://parseapi.com/dev
33
34
  @api_key = api_key || ENV['PARSEAPI_KEY']
34
35
  raise ArgumentError, 'parseapi: missing API key. Pass one or set PARSEAPI_KEY.' if @api_key.nil? || @api_key.empty?
35
36
 
@@ -54,12 +55,13 @@ module ParseAPI
54
55
  "#<#{self.class} api_key=[REDACTED] timeout=#{@timeout} retries=#{@retries.nil? ? 'auto' : @retries}>"
55
56
  end
56
57
 
57
- # --- Lookup methods (one per endpoint, named after the route) ---
58
58
 
59
+ # Look up an IP. Deep enrichment is included with a paid plan, without a separate check meter.
59
60
  def ip(ip, deep: false)
60
61
  get("/ip/#{seg(ip)}", deep: deep)
61
62
  end
62
63
 
64
+ # Look up the public IP making this request. On a server, this is the server's IP.
63
65
  def ip_self(deep: false)
64
66
  get('/ip', deep: deep)
65
67
  end
@@ -80,62 +82,68 @@ module ParseAPI
80
82
  get("/bloc/#{seg(code)}/countries")
81
83
  end
82
84
 
83
- def country(code)
84
- get("/country/#{seg(code)}")
85
+ def country(code, deep: false)
86
+ get("/country/#{seg(code)}", deep: deep)
85
87
  end
86
88
 
87
89
  def country_states(code)
88
90
  get("/country/#{seg(code)}/states")
89
91
  end
90
92
 
91
- def state(code, country: nil)
92
- get("/state/#{seg(code)}", country: country)
93
+ def state(code, country: nil, deep: false)
94
+ get("/state/#{seg(code)}", country: country, deep: deep)
93
95
  end
94
96
 
95
- def state_districts(code, country: nil)
96
- get("/state/#{seg(code)}/districts", country: country)
97
+ def state_districts(code, country: nil, deep: false)
98
+ get("/state/#{seg(code)}/districts", country: country, deep: deep)
97
99
  end
98
100
 
99
- def district(code, country: nil, state: nil)
100
- get("/district/#{seg(code)}", country: country, state: state)
101
+ def district(code, country: nil, state: nil, deep: false)
102
+ get("/district/#{seg(code)}", country: country, state: state, deep: deep)
101
103
  end
102
104
 
103
- def city(name, country: nil, state: nil)
104
- get("/city/#{seg(name)}", country: country, state: state)
105
+ def city(name, country: nil, state: nil, deep: false)
106
+ get("/city/#{seg(name)}", country: country, state: state, deep: deep)
105
107
  end
106
108
 
107
- def city_id(id)
108
- get("/city/id/#{seg(id)}")
109
+ def city_id(id, deep: false)
110
+ get("/city/id/#{seg(id)}", deep: deep)
109
111
  end
110
112
 
111
- def city_search(query, country: nil, state: nil, limit: nil)
112
- get('/city', q: query, country: country, state: state, limit: limit)
113
+ def city_search(query, country: nil, state: nil, limit: nil, deep: false)
114
+ get('/city', q: query, country: country, state: state, limit: limit, deep: deep)
113
115
  end
114
116
 
115
- def city_nearest(lat, lon)
116
- get('/city', lat: lat, lon: lon)
117
+ def city_nearest(lat, lon, deep: false)
118
+ get('/city', lat: lat, lon: lon, deep: deep)
117
119
  end
118
120
 
119
- def city_nearby(name, radius: nil, unit: nil, country: nil, state: nil, limit: nil)
120
- get("/city/#{seg(name)}/nearby", radius: radius, unit: unit, country: country, state: state, limit: limit)
121
+ def city_nearby(name, radius: nil, unit: nil, country: nil, state: nil, limit: nil, deep: false)
122
+ get("/city/#{seg(name)}/nearby", radius: radius, unit: unit, country: country, state: state, limit: limit, deep: deep)
121
123
  end
122
124
 
123
- def postal(code, country: nil)
124
- get("/postal/#{seg(code)}", country: country)
125
+ # Look up a postal area. Pass country when known. Check nullable coordinates before another
126
+ # location lookup.
127
+ def postal(code, country: nil, deep: false)
128
+ get("/postal/#{seg(code)}", country: country, deep: deep)
125
129
  end
126
130
 
127
- def postal_nearby(code, country: nil, radius: nil, unit: nil)
128
- get("/postal/#{seg(code)}/nearby", country: country, radius: radius, unit: unit)
131
+ def postal_nearby(code, country: nil, radius: nil, unit: nil, deep: false)
132
+ get("/postal/#{seg(code)}/nearby", country: country, radius: radius, unit: unit, deep: deep)
129
133
  end
130
134
 
131
- def postal_distance(from, to, country: nil)
132
- get("/postal/#{seg(from)}/distance/#{seg(to)}", country: country)
135
+ def postal_distance(from, to, country: nil, deep: false)
136
+ get("/postal/#{seg(from)}/distance/#{seg(to)}", country: country, deep: deep)
133
137
  end
134
138
 
135
139
  def address(address, country: nil, deep: false)
136
140
  get("/address/#{seg(address)}", country: country, deep: deep)
137
141
  end
138
142
 
143
+ # Find address suggestions using the context supplied. Prefer postal, or city and state, from
144
+ # the form; ip is an optional end-user locality hint for server-side calls. An empty result has
145
+ # reason more_input, missing_context or no_matches. Suggestions have reason null. Operational
146
+ # failures are errors.
139
147
  def address_search(query, country: nil, postal: nil, city: nil, state: nil, ip: nil)
140
148
  get('/address', q: query, country: country, postal: postal, city: city, state: state, ip: ip)
141
149
  end
@@ -144,38 +152,58 @@ module ParseAPI
144
152
  get("/company/#{seg(number)}", country: country, deep: deep)
145
153
  end
146
154
 
155
+ # Parse an email and check its format and domain. Deep explicitly requests a metered
156
+ # deliverability check. Deep checks use one attempt by default. An explicit retry count can
157
+ # repeat paid usage.
147
158
  def email(email, deep: false)
148
159
  get("/email/#{seg(email)}", deep: deep)
149
160
  end
150
161
 
162
+ # Check VAT format and checksum. Deep requests a metered registry check where supported. Deep
163
+ # checks use one attempt by default. Supply your own VAT number for a consultation reference
164
+ # when supported.
151
165
  def vat(number, country: nil, deep: false, from: nil)
152
166
  get("/vat/#{seg(number)}", country: country, deep: deep, from: from)
153
167
  end
154
168
 
155
- def iban(iban, country: nil)
156
- get("/iban/#{seg(iban)}", country: country)
169
+ def iban(iban, country: nil, deep: false)
170
+ get("/iban/#{seg(iban)}", country: country, deep: deep)
157
171
  end
158
172
 
173
+ # Look up a 6-11 digit card prefix, preserving leading zeros.
174
+ def bin(bin, deep: false)
175
+ get("/bin/#{seg(bin)}", deep: deep)
176
+ end
177
+
178
+
159
179
  def npi(npi, deep: false)
160
180
  get("/npi/#{seg(npi)}", deep: deep)
161
181
  end
162
182
 
183
+ # Parse a phone number and its formats. Pass country for national numbers when needed. Deep
184
+ # adds numbering-plan geography on every plan. Carrier, caller, and HLR are separate metered lookups.
163
185
  def phone(number, country: nil, deep: false)
164
186
  get("/phone/#{seg(number)}", country: country, deep: deep)
165
187
  end
166
188
 
167
- def carrier(number, country: nil)
168
- get("/carrier/#{seg(number)}", country: country)
189
+ # Request a metered carrier lookup. No automatic retries by default.
190
+ def carrier(number, country: nil, deep: false)
191
+ get("/carrier/#{seg(number)}", country: country, deep: deep)
169
192
  end
170
193
 
194
+ # Request a metered caller-name lookup for a NANP number. No automatic retries by default.
171
195
  def caller(number, country: nil)
172
196
  get("/caller/#{seg(number)}", country: country)
173
197
  end
174
198
 
175
- def hlr(number, country: nil)
176
- get("/hlr/#{seg(number)}", country: country)
199
+ # Look up phone status at the last check. Live means assigned and connected means reachable at
200
+ # that check. Cached results may be returned. Null means unconfirmed. Deep adds network
201
+ # diagnostics within the same metered lookup. No automatic retries by default.
202
+ def hlr(number, country: nil, deep: false)
203
+ get("/hlr/#{seg(number)}", country: country, deep: deep)
177
204
  end
178
205
 
206
+ # Check whether a domain is registered. Deep adds registration dates, registrar, status and DNSSEC on paid plans.
179
207
  def domain(domain, deep: false)
180
208
  get("/domain/#{seg(domain)}", deep: deep)
181
209
  end
@@ -188,6 +216,12 @@ module ParseAPI
188
216
  get("/mac/#{seg(mac)}")
189
217
  end
190
218
 
219
+ # Published DNS records with TTLs. Omit type to check all supported types.
220
+ # Type selects the question, including its CNAME chain. Pooled on every plan.
221
+ def dns(domain, type: nil)
222
+ get("/dns/#{seg(domain)}", type: type)
223
+ end
224
+
191
225
  def mx(domain)
192
226
  get("/mx/#{seg(domain)}")
193
227
  end
@@ -200,6 +234,20 @@ module ParseAPI
200
234
  get("/vin/#{seg(vin)}", deep: deep)
201
235
  end
202
236
 
237
+ # US NAICS 2022 definition and hierarchy.
238
+ def naics(code, deep: false)
239
+ get("/naics/#{seg(code)}", deep: deep)
240
+ end
241
+
242
+ # Keyword search. Limit defaults to 10 and accepts 1-50.
243
+ def naics_search(query, limit: nil, deep: false)
244
+ get('/naics', q: query, limit: limit, deep: deep)
245
+ end
246
+
247
+ # Look up the general US duty schedule line. Paid deep adds units and the special and other
248
+ # schedule columns. Add origin with deep to resolve country-specific measures. Without origin,
249
+ # schedule detail remains available and origin-dependent fields are null. A null effective rate
250
+ # is not a zero rate.
203
251
  def tariff(code, deep: false, origin: nil)
204
252
  get("/tariff/#{seg(code)}", deep: deep, origin: origin)
205
253
  end
@@ -208,36 +256,45 @@ module ParseAPI
208
256
  get('/tariff', q: query)
209
257
  end
210
258
 
211
- def currency(code)
212
- get("/currency/#{seg(code)}")
259
+ def currency(code, deep: false)
260
+ get("/currency/#{seg(code)}", deep: deep)
213
261
  end
214
262
 
215
263
  def currency_rate(base, quote, date: nil, amount: nil)
216
264
  get("/currency/#{seg(base)}/#{seg(quote)}", date: date, amount: amount)
217
265
  end
218
266
 
219
- def language(code)
220
- get("/language/#{seg(code)}")
267
+ def language(code, deep: false)
268
+ get("/language/#{seg(code)}", deep: deep)
221
269
  end
222
270
 
223
- def name(name)
224
- get("/name/#{seg(name)}")
271
+ def name(name, country: nil, deep: false)
272
+ get("/name/#{seg(name)}", country: country, deep: deep)
225
273
  end
226
274
 
227
- def timezone(id, at: nil, to: nil)
228
- get("/timezone/#{seg(id)}", at: at, to: to)
275
+ # Current local time, UTC by default. With to, offsetless at is source wall time.
276
+ def time(timezone = nil, at: nil, to: nil, deep: false)
277
+ get(timezone.nil? ? '/time' : "/time/#{seg(timezone)}", at: at, to: to, deep: deep)
229
278
  end
230
279
 
231
- def timezone_at(lat, lon, at: nil)
232
- get('/timezone', lat: lat, lon: lon, at: at)
280
+ def time_at(lat, lon, at: nil, to: nil, deep: false)
281
+ get('/time', lat: lat, lon: lon, at: at, to: to, deep: deep)
233
282
  end
234
283
 
235
- def date(date, format: nil, to: nil)
236
- get("/date/#{seg(date)}", format: format, to: to)
284
+ def timezone(id, at: nil, to: nil, deep: false)
285
+ get("/timezone/#{seg(id)}", at: at, to: to, deep: deep)
237
286
  end
238
287
 
239
- def date_today(to: nil)
240
- get('/date', to: to)
288
+ def timezone_at(lat, lon, at: nil, deep: false)
289
+ get('/timezone', lat: lat, lon: lon, at: at, deep: deep)
290
+ end
291
+
292
+ def date(date, format: nil, to: nil, deep: false)
293
+ get("/date/#{seg(date)}", format: format, to: to, deep: deep)
294
+ end
295
+
296
+ def date_today(to: nil, deep: false)
297
+ get('/date', to: to, deep: deep)
241
298
  end
242
299
 
243
300
  def holiday(country, year: nil)
@@ -252,20 +309,37 @@ module ParseAPI
252
309
  get('/elevation', lat: lat, lon: lon)
253
310
  end
254
311
 
312
+ # Resolve the country, state, district and timezone at coordinates. Deep adds terrain and
313
+ # compact nearest-city context on every plan. The timezone ID stays in core. The nearest city is
314
+ # null when none is within 200 km.
255
315
  def point(lat, lon, deep: false)
256
316
  get('/point', lat: lat, lon: lon, deep: deep)
257
317
  end
258
318
 
319
+ # Get current conditions in metric and imperial units. Paid deep adds specialist current
320
+ # measurements, forecasts and related detail. With deep, date selects a past UTC day (YYYY-MM-
321
+ # DD) in deep.history alongside current conditions. Date alone does not request history.
259
322
  def weather(lat, lon, deep: false, date: nil)
260
323
  get('/weather', lat: lat, lon: lon, deep: deep, date: date)
261
324
  end
262
325
 
263
- def emoji(emoji)
264
- get("/emoji/#{seg(emoji)}")
326
+ def emoji(emoji, deep: false)
327
+ get("/emoji/#{seg(emoji)}", deep: deep)
328
+ end
329
+
330
+ def emoji_search(query, limit: nil, deep: false)
331
+ get('/emoji', q: query, limit: limit, deep: deep)
332
+ end
333
+
334
+ # Parse or convert a measurement. Amount is a decimal string. Without to, use the
335
+ # type's canonical unit. Locale and system (us or imperial) resolve explicit ambiguity.
336
+ def measure(measure, to: nil, locale: nil, system: nil)
337
+ get("/measure/#{seg(measure)}", to: to, locale: locale, system: system)
265
338
  end
266
339
 
267
- def emoji_search(query, limit: nil)
268
- get('/emoji', q: query, limit: limit)
340
+ # Discover reviewed units. unit filters compatible conversion targets.
341
+ def measure_units(query: nil, type: nil, unit: nil)
342
+ get('/measure/units', q: query, type: type, unit: unit)
269
343
  end
270
344
 
271
345
  private
@@ -1,3 +1,3 @@
1
1
  module ParseAPI
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
data/lib/parseapi.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require_relative 'parseapi/version'
2
2
  require_relative 'parseapi/client'
3
3
 
4
- # Official parseAPI client for Ruby.
4
+ # Official ParseAPI client for Ruby.
5
5
  #
6
6
  # parse = ParseAPI.new('your-api-key')
7
7
  # parse.country('US')
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: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
- - parseAPI
7
+ - ParseAPI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-05 00:00:00.000000000 Z
11
+ date: 2026-09-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -47,5 +47,5 @@ requirements: []
47
47
  rubygems_version: 3.5.22
48
48
  signing_key:
49
49
  specification_version: 4
50
- summary: Official parseAPI client for Ruby. One key, minimal JSON, fast.
50
+ summary: Official ParseAPI client for Ruby. One key, minimal JSON, fast.
51
51
  test_files: []