addresszen 0.1.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.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE +1 -0
  4. data/README.md +34 -0
  5. data/lib/addresszen/base_client.rb +88 -0
  6. data/lib/addresszen/client.rb +12 -0
  7. data/lib/addresszen/errors.rb +59 -0
  8. data/lib/addresszen/generated.rb +78 -0
  9. data/lib/addresszen/model.rb +73 -0
  10. data/lib/addresszen/operations.rb +668 -0
  11. data/lib/addresszen/responses/api_key_details_response.rb +21 -0
  12. data/lib/addresszen/responses/api_key_response.rb +21 -0
  13. data/lib/addresszen/responses/api_key_usage_response.rb +21 -0
  14. data/lib/addresszen/responses/autocomplete_response.rb +19 -0
  15. data/lib/addresszen/responses/config_response.rb +21 -0
  16. data/lib/addresszen/responses/configs_response.rb +21 -0
  17. data/lib/addresszen/responses/delete_config_response.rb +19 -0
  18. data/lib/addresszen/responses/delete_licensee_response.rb +19 -0
  19. data/lib/addresszen/responses/email_response.rb +31 -0
  20. data/lib/addresszen/responses/licensee_response.rb +21 -0
  21. data/lib/addresszen/responses/licensees_response.rb +21 -0
  22. data/lib/addresszen/responses/phone_number_response.rb +31 -0
  23. data/lib/addresszen/responses/place_response.rb +19 -0
  24. data/lib/addresszen/responses/resolve_place_response.rb +24 -0
  25. data/lib/addresszen/responses/usa_resolve_address_response.rb +21 -0
  26. data/lib/addresszen/responses/verify_response.rb +31 -0
  27. data/lib/addresszen/transport.rb +61 -0
  28. data/lib/addresszen/types/ab_address.rb +283 -0
  29. data/lib/addresszen/types/abp_address.rb +674 -0
  30. data/lib/addresszen/types/address.rb +265 -0
  31. data/lib/addresszen/types/address_suggestion.rb +27 -0
  32. data/lib/addresszen/types/api_key.rb +27 -0
  33. data/lib/addresszen/types/api_key_automated_topup.rb +17 -0
  34. data/lib/addresszen/types/api_key_current_purchase.rb +27 -0
  35. data/lib/addresszen/types/api_key_daily_limit.rb +21 -0
  36. data/lib/addresszen/types/api_key_datasets.rb +202 -0
  37. data/lib/addresszen/types/api_key_details.rb +90 -0
  38. data/lib/addresszen/types/api_key_individual_limit.rb +16 -0
  39. data/lib/addresszen/types/api_key_monthly_limit.rb +21 -0
  40. data/lib/addresszen/types/api_key_notifications.rb +35 -0
  41. data/lib/addresszen/types/autocomplete_result.rb +13 -0
  42. data/lib/addresszen/types/available_context.rb +35 -0
  43. data/lib/addresszen/types/ban_address.rb +179 -0
  44. data/lib/addresszen/types/bev_address.rb +288 -0
  45. data/lib/addresszen/types/cannar_address.rb +297 -0
  46. data/lib/addresszen/types/carrier.rb +31 -0
  47. data/lib/addresszen/types/config.rb +34 -0
  48. data/lib/addresszen/types/configs_result.rb +15 -0
  49. data/lib/addresszen/types/deleted_config.rb +13 -0
  50. data/lib/addresszen/types/deleted_licensee.rb +13 -0
  51. data/lib/addresszen/types/ecad_address.rb +393 -0
  52. data/lib/addresszen/types/ecaf_address.rb +204 -0
  53. data/lib/addresszen/types/email.rb +45 -0
  54. data/lib/addresszen/types/fodbosa_address.rb +201 -0
  55. data/lib/addresszen/types/geonames_place.rb +153 -0
  56. data/lib/addresszen/types/gnaf_address.rb +463 -0
  57. data/lib/addresszen/types/here_address.rb +174 -0
  58. data/lib/addresszen/types/invalid_phone_number.rb +50 -0
  59. data/lib/addresszen/types/kadaster_address.rb +480 -0
  60. data/lib/addresszen/types/kartverket_address.rb +342 -0
  61. data/lib/addresszen/types/key_usage_day.rb +16 -0
  62. data/lib/addresszen/types/key_usage_result.rb +36 -0
  63. data/lib/addresszen/types/licensee.rb +50 -0
  64. data/lib/addresszen/types/licensee_daily_usage.rb +29 -0
  65. data/lib/addresszen/types/licensees_result.rb +23 -0
  66. data/lib/addresszen/types/mois_address.rb +440 -0
  67. data/lib/addresszen/types/mr_address.rb +99 -0
  68. data/lib/addresszen/types/native_record.rb +368 -0
  69. data/lib/addresszen/types/nyb_address.rb +99 -0
  70. data/lib/addresszen/types/paf_address.rb +96 -0
  71. data/lib/addresszen/types/pafa_address.rb +104 -0
  72. data/lib/addresszen/types/pafw_address.rb +99 -0
  73. data/lib/addresszen/types/phone_number.rb +50 -0
  74. data/lib/addresszen/types/place.rb +79 -0
  75. data/lib/addresszen/types/place_result.rb +21 -0
  76. data/lib/addresszen/types/place_suggestion.rb +32 -0
  77. data/lib/addresszen/types/sdfi_address.rb +520 -0
  78. data/lib/addresszen/types/swt_address.rb +247 -0
  79. data/lib/addresszen/types/unknown_email.rb +43 -0
  80. data/lib/addresszen/types/upujp_address.rb +763 -0
  81. data/lib/addresszen/types/usa_cass_verified_address.rb +254 -0
  82. data/lib/addresszen/types/usa_verify_match.rb +116 -0
  83. data/lib/addresszen/types/usa_verify_no_match.rb +81 -0
  84. data/lib/addresszen/types/usps_address.rb +294 -0
  85. data/lib/addresszen/version.rb +5 -0
  86. data/lib/addresszen.rb +14 -0
  87. data/sig/addresszen/base_client.rbs +40 -0
  88. data/sig/addresszen/client.rbs +5 -0
  89. data/sig/addresszen/errors.rbs +27 -0
  90. data/sig/addresszen/model.rbs +37 -0
  91. data/sig/addresszen/operations.rbs +153 -0
  92. data/sig/addresszen/responses/api_key_details_response.rbs +13 -0
  93. data/sig/addresszen/responses/api_key_response.rbs +13 -0
  94. data/sig/addresszen/responses/api_key_usage_response.rbs +13 -0
  95. data/sig/addresszen/responses/autocomplete_response.rbs +13 -0
  96. data/sig/addresszen/responses/config_response.rbs +13 -0
  97. data/sig/addresszen/responses/configs_response.rbs +13 -0
  98. data/sig/addresszen/responses/delete_config_response.rbs +13 -0
  99. data/sig/addresszen/responses/delete_licensee_response.rbs +13 -0
  100. data/sig/addresszen/responses/email_response.rbs +19 -0
  101. data/sig/addresszen/responses/licensee_response.rbs +13 -0
  102. data/sig/addresszen/responses/licensees_response.rbs +13 -0
  103. data/sig/addresszen/responses/phone_number_response.rbs +19 -0
  104. data/sig/addresszen/responses/place_response.rbs +13 -0
  105. data/sig/addresszen/responses/resolve_place_response.rbs +13 -0
  106. data/sig/addresszen/responses/usa_resolve_address_response.rbs +13 -0
  107. data/sig/addresszen/responses/verify_response.rbs +19 -0
  108. data/sig/addresszen/transport.rbs +39 -0
  109. data/sig/addresszen/types/ab_address.rbs +57 -0
  110. data/sig/addresszen/types/abp_address.rbs +126 -0
  111. data/sig/addresszen/types/address.rbs +142 -0
  112. data/sig/addresszen/types/address_suggestion.rbs +11 -0
  113. data/sig/addresszen/types/api_key.rbs +11 -0
  114. data/sig/addresszen/types/api_key_automated_topup.rbs +9 -0
  115. data/sig/addresszen/types/api_key_current_purchase.rbs +11 -0
  116. data/sig/addresszen/types/api_key_daily_limit.rbs +10 -0
  117. data/sig/addresszen/types/api_key_datasets.rbs +46 -0
  118. data/sig/addresszen/types/api_key_details.rbs +22 -0
  119. data/sig/addresszen/types/api_key_individual_limit.rbs +9 -0
  120. data/sig/addresszen/types/api_key_monthly_limit.rbs +10 -0
  121. data/sig/addresszen/types/api_key_notifications.rbs +13 -0
  122. data/sig/addresszen/types/autocomplete_result.rbs +9 -0
  123. data/sig/addresszen/types/available_context.rbs +13 -0
  124. data/sig/addresszen/types/ban_address.rbs +46 -0
  125. data/sig/addresszen/types/bev_address.rbs +67 -0
  126. data/sig/addresszen/types/cannar_address.rbs +62 -0
  127. data/sig/addresszen/types/carrier.rbs +14 -0
  128. data/sig/addresszen/types/config.rbs +14 -0
  129. data/sig/addresszen/types/configs_result.rbs +9 -0
  130. data/sig/addresszen/types/deleted_config.rbs +9 -0
  131. data/sig/addresszen/types/deleted_licensee.rbs +9 -0
  132. data/sig/addresszen/types/ecad_address.rbs +84 -0
  133. data/sig/addresszen/types/ecaf_address.rbs +45 -0
  134. data/sig/addresszen/types/email.rbs +16 -0
  135. data/sig/addresszen/types/fodbosa_address.rbs +43 -0
  136. data/sig/addresszen/types/geonames_place.rbs +42 -0
  137. data/sig/addresszen/types/gnaf_address.rbs +104 -0
  138. data/sig/addresszen/types/here_address.rbs +37 -0
  139. data/sig/addresszen/types/invalid_phone_number.rbs +17 -0
  140. data/sig/addresszen/types/kadaster_address.rbs +98 -0
  141. data/sig/addresszen/types/kartverket_address.rbs +78 -0
  142. data/sig/addresszen/types/key_usage_day.rbs +10 -0
  143. data/sig/addresszen/types/key_usage_result.rbs +13 -0
  144. data/sig/addresszen/types/licensee.rbs +17 -0
  145. data/sig/addresszen/types/licensee_daily_usage.rbs +12 -0
  146. data/sig/addresszen/types/licensees_result.rbs +11 -0
  147. data/sig/addresszen/types/mois_address.rbs +97 -0
  148. data/sig/addresszen/types/mr_address.rbs +27 -0
  149. data/sig/addresszen/types/native_record.rbs +34 -0
  150. data/sig/addresszen/types/nyb_address.rbs +27 -0
  151. data/sig/addresszen/types/paf_address.rbs +27 -0
  152. data/sig/addresszen/types/pafa_address.rbs +27 -0
  153. data/sig/addresszen/types/pafw_address.rbs +27 -0
  154. data/sig/addresszen/types/phone_number.rbs +17 -0
  155. data/sig/addresszen/types/place.rbs +29 -0
  156. data/sig/addresszen/types/place_result.rbs +15 -0
  157. data/sig/addresszen/types/place_suggestion.rbs +12 -0
  158. data/sig/addresszen/types/sdfi_address.rbs +108 -0
  159. data/sig/addresszen/types/swt_address.rbs +57 -0
  160. data/sig/addresszen/types/unknown_email.rbs +16 -0
  161. data/sig/addresszen/types/upujp_address.rbs +156 -0
  162. data/sig/addresszen/types/usa_cass_verified_address.rbs +62 -0
  163. data/sig/addresszen/types/usa_verify_match.rbs +29 -0
  164. data/sig/addresszen/types/usa_verify_no_match.rbs +32 -0
  165. data/sig/addresszen/types/usps_address.rbs +63 -0
  166. metadata +209 -0
@@ -0,0 +1,668 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated from the OpenAPI spec. Do not edit.
4
+
5
+ module AddressZen
6
+ # One method per API operation, named from its `operationId`. Client includes it.
7
+ #
8
+ # Path parameters are positional; query parameters and body properties are
9
+ # keyword arguments. A keyword left nil is not sent.
10
+ module Operations
11
+ # Availability.
12
+ #
13
+ # Returns public information on an API Key: whether it can be used right now (`available`), the
14
+ # search contexts the key is licensed for (`contexts`) and the context that best matches the
15
+ # caller's IP address (`context`).
16
+ #
17
+ # @param key [String] API Key
18
+ # @return [Responses::ApiKeyResponse]
19
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/key-availability
20
+ def key_availability(key)
21
+ request(
22
+ "GET",
23
+ "/keys/{key}",
24
+ :none,
25
+ path: { "key" => key },
26
+ response: Responses::ApiKeyResponse
27
+ )
28
+ end
29
+
30
+ # Details.
31
+ #
32
+ # Returns private data on a key: remaining lookups, licensed datasets, usage limits,
33
+ # notification settings and the search contexts the key can serve.
34
+ #
35
+ # Needs the Management Key.
36
+ #
37
+ # @param key [String] API Key
38
+ # @return [Responses::ApiKeyDetailsResponse]
39
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/key-details
40
+ def key_details(key)
41
+ request(
42
+ "GET",
43
+ "/keys/{key}/details",
44
+ :management_key,
45
+ path: { "key" => key },
46
+ response: Responses::ApiKeyDetailsResponse
47
+ )
48
+ end
49
+
50
+ # Update Details.
51
+ #
52
+ # Updates a key's settings and returns its private details. Only the fields you send change. A
53
+ # key on an unlimited plan ignores changes to `datasets`, `daily_limit` and `monthly_limit`.
54
+ # Datasets set by your plan cannot be changed here: sending one with a different value returns a
55
+ # 400.
56
+ #
57
+ # Needs the Management Key.
58
+ #
59
+ # @param key [String] API Key
60
+ # @param name [String] A name for the key
61
+ # @param daily_limit [Hash]
62
+ # @param monthly_limit [Hash]
63
+ # @param individual_limit [Hash]
64
+ # @param allowed_urls [Array<String>] A list of allowed URLs. An empty list disables the check.
65
+ # Up to 10 allowed.
66
+ # @param redact_days [Integer] Number of days to preserve personal data stored in your key usage
67
+ # history. Set to 0 to prevent personal data storage
68
+ # @param notifications [Hash]
69
+ # @param ip_forwarding [Boolean] Accept IP addresses forwarded in the `AZ-Source-IP` header
70
+ # @param datasets [Hash] Datasets you can switch on or off for this key. Datasets set by your
71
+ # plan (`paf`, `mr`, `nyb`, `ecad`, `ecaf`) cannot be changed here: sending one with a
72
+ # different value returns a 400.
73
+ # @return [Responses::ApiKeyDetailsResponse]
74
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/update-key-details
75
+ def update_key_details(
76
+ key,
77
+ name: nil,
78
+ daily_limit: nil,
79
+ monthly_limit: nil,
80
+ individual_limit: nil,
81
+ allowed_urls: nil,
82
+ redact_days: nil,
83
+ notifications: nil,
84
+ ip_forwarding: nil,
85
+ datasets: nil
86
+ )
87
+ request(
88
+ "PUT",
89
+ "/keys/{key}/details",
90
+ :management_key,
91
+ path: { "key" => key },
92
+ body: {
93
+ "name" => name,
94
+ "daily_limit" => daily_limit,
95
+ "monthly_limit" => monthly_limit,
96
+ "individual_limit" => individual_limit,
97
+ "allowed_urls" => allowed_urls,
98
+ "redact_days" => redact_days,
99
+ "notifications" => notifications,
100
+ "ip_forwarding" => ip_forwarding,
101
+ "datasets" => datasets
102
+ },
103
+ response: Responses::ApiKeyDetailsResponse
104
+ )
105
+ end
106
+
107
+ # Usage Stats.
108
+ #
109
+ # Reports the number of lookups a key consumed over a date range, as a total and a daily
110
+ # breakdown.
111
+ #
112
+ # Needs the Management Key.
113
+ #
114
+ # @param key [String] API Key
115
+ # @param start [Integer] Start Timestamp
116
+ # @param end [Integer] End Timestamp
117
+ # @param tags [String, Array<String>] Tags
118
+ # @param licensee [String] Licensee Key
119
+ # @return [Responses::ApiKeyUsageResponse]
120
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/key-usage
121
+ def key_usage(key, start: nil, end: nil, tags: nil, licensee: nil)
122
+ request(
123
+ "GET",
124
+ "/keys/{key}/usage",
125
+ :management_key,
126
+ path: { "key" => key },
127
+ query: {
128
+ "start" => start,
129
+ "end" => binding.local_variable_get(:end),
130
+ "tags" => tags,
131
+ "licensee" => licensee
132
+ },
133
+ response: Responses::ApiKeyUsageResponse
134
+ )
135
+ end
136
+
137
+ # Logs (CSV).
138
+ #
139
+ # Returns a CSV of the charged lookups made on a key, one row per request.
140
+ #
141
+ # Needs the Management Key.
142
+ #
143
+ # @param key [String] API Key
144
+ # @param start [Integer] Start Timestamp
145
+ # @param end [Integer] End Timestamp
146
+ # @param licensee [String] Licensee Key
147
+ # @return [String]
148
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/key-logs
149
+ def key_logs(key, start: nil, end: nil, licensee: nil)
150
+ request(
151
+ "GET",
152
+ "/keys/{key}/lookups",
153
+ :management_key,
154
+ path: { "key" => key },
155
+ query: {
156
+ "start" => start,
157
+ "end" => binding.local_variable_get(:end),
158
+ "licensee" => licensee
159
+ }
160
+ )
161
+ end
162
+
163
+ # Verify Address.
164
+ #
165
+ # Verifies an address against the USPS Coding Accuracy Support System (CASS) and returns it
166
+ # standardized and corrected.
167
+ #
168
+ # @param query [String] Address input to verify.
169
+ # @param tags [String, Array<String>] Tags
170
+ # @param remove_firm [String] Remove Firm
171
+ # @param context [String] Identify the country of the address to verify. Defaults to United
172
+ # States (USA)
173
+ # @param zip_code [String] Specify the ZIP code of an address. The following formats are
174
+ # accepted: `81073-1119`, `810731119`, `81073`.
175
+ # @param city [String] City of an address.
176
+ # @param state [String] State of an address. For the US, use the 2-letter state abbreviation.
177
+ # @return [Responses::VerifyResponse]
178
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/address-verify
179
+ def address_verify(
180
+ query:,
181
+ tags: nil,
182
+ remove_firm: nil,
183
+ context: nil,
184
+ zip_code: nil,
185
+ city: nil,
186
+ state: nil
187
+ )
188
+ request(
189
+ "POST",
190
+ "/verify/addresses",
191
+ :api_key,
192
+ query: { "tags" => tags, "remove_firm" => remove_firm, "context" => context },
193
+ body: { "query" => query, "zip_code" => zip_code, "city" => city, "state" => state },
194
+ response: Responses::VerifyResponse
195
+ )
196
+ end
197
+
198
+ # Find Address.
199
+ #
200
+ # Returns address suggestions for a partial address, ranked by relevance. Use it to autofill an
201
+ # address form as the user types.
202
+ #
203
+ # @param query [String] Address Query
204
+ # @param dataset [Array<String>] Filter by Dataset
205
+ # @param context [String] Context
206
+ # @param limit [Integer] Limit
207
+ # @param bias_lonlat [String] Bias by Geolocation
208
+ # @param bias_ip [String] Bias by Geolocation of IP
209
+ # @param box [String, Array<String>] Filter by Bounding Box
210
+ # @param postal_code [String] Filter by postal code
211
+ # @param postal_code_2 [String] Filter by postal code prefix
212
+ # @param postal_code_3 [String] Filter by short postal code
213
+ # @param city [String] Filter by city
214
+ # @param state [String] Filter by state
215
+ # @param state_code [String] Filter by state code
216
+ # @param bias_postal_code [String] Bias by postal code
217
+ # @param bias_postal_code_2 [String] Bias by postal code prefix
218
+ # @param bias_postal_code_3 [String] Bias by short postal code
219
+ # @param bias_city [String] Bias by city
220
+ # @param bias_state [String] Bias by state
221
+ # @param bias_state_code [String] Bias by state code
222
+ # @param is_pobox [String] Filter by PO Box
223
+ # @param is_business [String] Filter by business address
224
+ # @return [Responses::AutocompleteResponse]
225
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/find-address
226
+ def find_address(
227
+ query: nil,
228
+ dataset: nil,
229
+ context: nil,
230
+ limit: nil,
231
+ bias_lonlat: nil,
232
+ bias_ip: nil,
233
+ box: nil,
234
+ postal_code: nil,
235
+ postal_code_2: nil,
236
+ postal_code_3: nil,
237
+ city: nil,
238
+ state: nil,
239
+ state_code: nil,
240
+ bias_postal_code: nil,
241
+ bias_postal_code_2: nil,
242
+ bias_postal_code_3: nil,
243
+ bias_city: nil,
244
+ bias_state: nil,
245
+ bias_state_code: nil,
246
+ is_pobox: nil,
247
+ is_business: nil
248
+ )
249
+ request(
250
+ "GET",
251
+ "/autocomplete/addresses",
252
+ :api_key,
253
+ query: {
254
+ "query" => query,
255
+ "dataset" => dataset,
256
+ "context" => context,
257
+ "limit" => limit,
258
+ "bias_lonlat" => bias_lonlat,
259
+ "bias_ip" => bias_ip,
260
+ "box" => box,
261
+ "postal_code" => postal_code,
262
+ "postal_code_2" => postal_code_2,
263
+ "postal_code_3" => postal_code_3,
264
+ "city" => city,
265
+ "state" => state,
266
+ "state_code" => state_code,
267
+ "bias_postal_code" => bias_postal_code,
268
+ "bias_postal_code_2" => bias_postal_code_2,
269
+ "bias_postal_code_3" => bias_postal_code_3,
270
+ "bias_city" => bias_city,
271
+ "bias_state" => bias_state,
272
+ "bias_state_code" => bias_state_code,
273
+ "is_pobox" => is_pobox,
274
+ "is_business" => is_business
275
+ },
276
+ response: Responses::AutocompleteResponse
277
+ )
278
+ end
279
+
280
+ # Retrieve Address.
281
+ #
282
+ # Returns the full address for an autocomplete suggestion id.
283
+ #
284
+ # @param address [String] ID of address suggestion
285
+ # @param licensee [String] Licensee Key
286
+ # @param filter [String, Array<String>] Restrict Result Fields
287
+ # @param tags [String, Array<String>] Tags
288
+ # @param remove_firm [String] Remove Firm
289
+ # @return [Responses::UsaResolveAddressResponse]
290
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/retrieve-address
291
+ def retrieve_address(address, licensee: nil, filter: nil, tags: nil, remove_firm: nil)
292
+ request(
293
+ "GET",
294
+ "/autocomplete/addresses/{address}/usa",
295
+ :api_key,
296
+ path: { "address" => address },
297
+ query: {
298
+ "licensee" => licensee,
299
+ "filter" => filter,
300
+ "tags" => tags,
301
+ "remove_firm" => remove_firm
302
+ },
303
+ response: Responses::UsaResolveAddressResponse
304
+ )
305
+ end
306
+
307
+ # Find Place.
308
+ #
309
+ # Returns place suggestions for a query, ranked by relevance. Places cover countries,
310
+ # administrative areas, capitals and other administrative seats.
311
+ #
312
+ # @param query [String] Specifies the place to query. Can be shortened to `q=`
313
+ # @param country_iso [String, Array<String>] Filter by Country
314
+ # @param bias_country_iso [String, Array<String>] Bias by Country Bias by country ISO code. Uses
315
+ # 3 letter country code (ISO 3166-1) standard. Bias by multiple countries with a comma
316
+ # separated list. E.g. `GBR,IRL`
317
+ # @param bias_lonlat [String] Bias by Geolocation
318
+ # @param bias_ip [String] Bias by Geolocation of IP
319
+ # @return [Responses::PlaceResponse]
320
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/find-place
321
+ def find_place(
322
+ query: nil,
323
+ country_iso: nil,
324
+ bias_country_iso: nil,
325
+ bias_lonlat: nil,
326
+ bias_ip: nil
327
+ )
328
+ request(
329
+ "GET",
330
+ "/places",
331
+ :api_key,
332
+ query: {
333
+ "query" => query,
334
+ "country_iso" => country_iso,
335
+ "bias_country_iso" => bias_country_iso,
336
+ "bias_lonlat" => bias_lonlat,
337
+ "bias_ip" => bias_ip
338
+ },
339
+ response: Responses::PlaceResponse
340
+ )
341
+ end
342
+
343
+ # Resolve Place.
344
+ #
345
+ # Returns the full place for a place ID taken from a `/places` suggestion.
346
+ #
347
+ # @param place [String] ID of place suggestion
348
+ # @param tags [String, Array<String>] Tags
349
+ # @return [Responses::ResolvePlaceResponse]
350
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/resolve-place
351
+ def resolve_place(place, tags: nil)
352
+ request(
353
+ "GET",
354
+ "/places/{place}",
355
+ :api_key,
356
+ path: { "place" => place },
357
+ query: { "tags" => tags },
358
+ response: Responses::ResolvePlaceResponse
359
+ )
360
+ end
361
+
362
+ # List.
363
+ #
364
+ # Returns a key's licensees, oldest first, up to 100 per request. The list omits canceled
365
+ # licensees. The key must be enabled for sub-licensing.
366
+ #
367
+ # Needs the Management Key.
368
+ #
369
+ # @param key [String] API Key
370
+ # @param starting_after [String] ID of the licensee after which to list results. Pass the `id`
371
+ # of the last licensee on the previous page.
372
+ # @param limit [Integer] Limit
373
+ # @param query [String] Filter results by licensee name. Can be shortened to `q=`
374
+ # @return [Responses::LicenseesResponse]
375
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/list-licensees
376
+ def list_licensees(key, starting_after: nil, limit: nil, query: nil)
377
+ request(
378
+ "GET",
379
+ "/keys/{key}/licensees",
380
+ :management_key,
381
+ path: { "key" => key },
382
+ query: { "starting_after" => starting_after, "limit" => limit, "query" => query },
383
+ response: Responses::LicenseesResponse
384
+ )
385
+ end
386
+
387
+ # Create.
388
+ #
389
+ # Creates a licensee on a key and returns it with its generated `sl_` key. The key must be
390
+ # enabled for sub-licensing.
391
+ #
392
+ # Needs the Management Key.
393
+ #
394
+ # @param key [String] API Key
395
+ # @param name [String] Licensee individual or organisation name
396
+ # @param address [String] Licensee's first, second and third line address as well as post town
397
+ # concatenated by commas
398
+ # @param postcode [String] Licensee's postcode
399
+ # @param whitelist [Array<String>] A list of allowed URLs. An empty list disables the check.
400
+ # @param daily [Hash]
401
+ # @return [Responses::LicenseeResponse]
402
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/create-licensee
403
+ def create_licensee(key, name: nil, address: nil, postcode: nil, whitelist: nil, daily: nil)
404
+ request(
405
+ "POST",
406
+ "/keys/{key}/licensees",
407
+ :management_key,
408
+ path: { "key" => key },
409
+ body: {
410
+ "name" => name,
411
+ "address" => address,
412
+ "postcode" => postcode,
413
+ "whitelist" => whitelist,
414
+ "daily" => daily
415
+ },
416
+ response: Responses::LicenseeResponse
417
+ )
418
+ end
419
+
420
+ # Retrieve.
421
+ #
422
+ # Returns a licensee by its `sl_` key. A canceled or unknown licensee returns `404`.
423
+ #
424
+ # Needs the Management Key.
425
+ #
426
+ # @param key [String] API Key
427
+ # @param licensee [String] Licensee Key
428
+ # @return [Responses::LicenseeResponse]
429
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/retrieve-licensee
430
+ def retrieve_licensee(key, licensee)
431
+ request(
432
+ "GET",
433
+ "/keys/{key}/licensees/{licensee}",
434
+ :management_key,
435
+ path: { "key" => key, "licensee" => licensee },
436
+ response: Responses::LicenseeResponse
437
+ )
438
+ end
439
+
440
+ # Cancel.
441
+ #
442
+ # Cancels a licensee. Its key stops working and it drops out of the licensee list. Contact us to
443
+ # reverse it.
444
+ #
445
+ # Needs the Management Key.
446
+ #
447
+ # @param key [String] API Key
448
+ # @param licensee [String] Licensee Key
449
+ # @return [Responses::DeleteLicenseeResponse]
450
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/delete-licensee
451
+ def delete_licensee(key, licensee)
452
+ request(
453
+ "DELETE",
454
+ "/keys/{key}/licensees/{licensee}",
455
+ :management_key,
456
+ path: { "key" => key, "licensee" => licensee },
457
+ response: Responses::DeleteLicenseeResponse
458
+ )
459
+ end
460
+
461
+ # Update.
462
+ #
463
+ # Updates a licensee's address, postcode, allowed URLs and daily limit. Returns the updated
464
+ # licensee. The name is fixed at creation.
465
+ #
466
+ # Needs the Management Key.
467
+ #
468
+ # @param key [String] API Key
469
+ # @param licensee [String] Licensee Key
470
+ # @param name [String] Licensee individual or organisation name
471
+ # @param address [String] Licensee's first, second and third line address as well as post town
472
+ # concatenated by commas
473
+ # @param postcode [String] Licensee's postcode
474
+ # @param whitelist [Array<String>] A list of allowed URLs. An empty list disables the check.
475
+ # @param daily [Hash]
476
+ # @return [Responses::LicenseeResponse]
477
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/update-licensee
478
+ def update_licensee(
479
+ key,
480
+ licensee,
481
+ name: nil,
482
+ address: nil,
483
+ postcode: nil,
484
+ whitelist: nil,
485
+ daily: nil
486
+ )
487
+ request(
488
+ "POST",
489
+ "/keys/{key}/licensees/{licensee}",
490
+ :management_key,
491
+ path: { "key" => key, "licensee" => licensee },
492
+ body: {
493
+ "name" => name,
494
+ "address" => address,
495
+ "postcode" => postcode,
496
+ "whitelist" => whitelist,
497
+ "daily" => daily
498
+ },
499
+ response: Responses::LicenseeResponse
500
+ )
501
+ end
502
+
503
+ # Regenerate Key.
504
+ #
505
+ # Regenerates a licensee's key and returns the licensee with the new key. The previous key stops
506
+ # working immediately, so update any integration that uses it.
507
+ #
508
+ # Needs the Management Key.
509
+ #
510
+ # @param key [String] API Key
511
+ # @param licensee [String] Licensee Key
512
+ # @return [Responses::LicenseeResponse]
513
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/regenerate-licensee-key
514
+ def regenerate_licensee_key(key, licensee)
515
+ request(
516
+ "POST",
517
+ "/keys/{key}/licensees/{licensee}/regenerate-key",
518
+ :management_key,
519
+ path: { "key" => key, "licensee" => licensee },
520
+ response: Responses::LicenseeResponse
521
+ )
522
+ end
523
+
524
+ # List.
525
+ #
526
+ # Returns every configuration stored against a key, oldest first.
527
+ #
528
+ # Needs the Management Key.
529
+ #
530
+ # @param key [String] API Key
531
+ # @return [Responses::ConfigsResponse]
532
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/list-configs
533
+ def list_configs(key)
534
+ request(
535
+ "GET",
536
+ "/keys/{key}/configs",
537
+ :management_key,
538
+ path: { "key" => key },
539
+ response: Responses::ConfigsResponse
540
+ )
541
+ end
542
+
543
+ # Create.
544
+ #
545
+ # Creates a named configuration on a key and returns it.
546
+ #
547
+ # Needs the Management Key.
548
+ #
549
+ # @param key [String] API Key
550
+ # @param name [String] A unique name to identify the configuration payload
551
+ # @param payload [String] A serialized payload of up to `65536` characters
552
+ # @return [Responses::ConfigResponse]
553
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/create-config
554
+ def create_config(key, name:, payload:)
555
+ request(
556
+ "POST",
557
+ "/keys/{key}/configs",
558
+ :management_key,
559
+ path: { "key" => key },
560
+ body: { "name" => name, "payload" => payload },
561
+ response: Responses::ConfigResponse
562
+ )
563
+ end
564
+
565
+ # Retrieve.
566
+ #
567
+ # Returns a configuration by name. This request needs no `user_token`, so a browser integration
568
+ # can read its own configuration at runtime.
569
+ #
570
+ # @param key [String] API Key
571
+ # @param config [String] Configuration Name
572
+ # @return [Responses::ConfigResponse]
573
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/retrieve-config
574
+ def retrieve_config(key, config)
575
+ request(
576
+ "GET",
577
+ "/keys/{key}/configs/{config}",
578
+ :none,
579
+ path: { "key" => key, "config" => config },
580
+ response: Responses::ConfigResponse
581
+ )
582
+ end
583
+
584
+ # Delete.
585
+ #
586
+ # Permanently deletes a configuration object.
587
+ #
588
+ # Needs the Management Key.
589
+ #
590
+ # @param key [String] API Key
591
+ # @param config [String] Configuration Name
592
+ # @return [Responses::DeleteConfigResponse]
593
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/delete-config
594
+ def delete_config(key, config)
595
+ request(
596
+ "DELETE",
597
+ "/keys/{key}/configs/{config}",
598
+ :management_key,
599
+ path: { "key" => key, "config" => config },
600
+ response: Responses::DeleteConfigResponse
601
+ )
602
+ end
603
+
604
+ # Update.
605
+ #
606
+ # Replaces a configuration's payload and returns the updated configuration. The name is fixed at
607
+ # creation.
608
+ #
609
+ # Needs the Management Key.
610
+ #
611
+ # @param key [String] API Key
612
+ # @param config [String] Configuration Name
613
+ # @param payload [String] A serialized payload of up to `65536` characters
614
+ # @return [Responses::ConfigResponse]
615
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/update-config
616
+ def update_config(key, config, payload: nil)
617
+ request(
618
+ "POST",
619
+ "/keys/{key}/configs/{config}",
620
+ :management_key,
621
+ path: { "key" => key, "config" => config },
622
+ body: { "payload" => payload },
623
+ response: Responses::ConfigResponse
624
+ )
625
+ end
626
+
627
+ # Email Validation.
628
+ #
629
+ # Validates an email address and reports whether it is deliverable.
630
+ #
631
+ # @param query [String] Specifies the email address to validate
632
+ # @param tags [String, Array<String>] Tags
633
+ # @return [Responses::EmailResponse]
634
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/email-validation
635
+ def email_validation(query:, tags: nil)
636
+ request(
637
+ "GET",
638
+ "/emails",
639
+ :api_key,
640
+ query: { "query" => query, "tags" => tags },
641
+ response: Responses::EmailResponse
642
+ )
643
+ end
644
+
645
+ # Phone Number Validation.
646
+ #
647
+ # Validates a phone number and returns its country, its national and international formats, and
648
+ # the network it was originally assigned to.
649
+ #
650
+ # @param query [String] Specifies the phone number to validate. Phone number must include a
651
+ # country code in an acceptable format. For instance, UK phone numbers should be prefixed with
652
+ # `+44`, `44` or `0044`.
653
+ # @param current_carrier [String] When set to `true`, the API retrieves and populates the
654
+ # current network of the phone number.
655
+ # @param tags [String, Array<String>] Tags
656
+ # @return [Responses::PhoneNumberResponse]
657
+ # @see https://docs.addresszen.com/docs/sdks/ruby/endpoints/phone-number-validation
658
+ def phone_number_validation(query:, current_carrier: nil, tags: nil)
659
+ request(
660
+ "GET",
661
+ "/phone_numbers",
662
+ :api_key,
663
+ query: { "query" => query, "current_carrier" => current_carrier, "tags" => tags },
664
+ response: Responses::PhoneNumberResponse
665
+ )
666
+ end
667
+ end
668
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated from the OpenAPI spec. Do not edit.
4
+
5
+ module AddressZen
6
+ module Responses
7
+ # API Key Details Response
8
+ class ApiKeyDetailsResponse < Model
9
+ # API Key Details
10
+ #
11
+ # @return [Types::ApiKeyDetails]
12
+ def result = read("result") { |v| Types::ApiKeyDetails.from_hash(v) }
13
+
14
+ # @return [Integer]
15
+ def code = @hash["code"]
16
+
17
+ # @return [String]
18
+ def message = @hash["message"]
19
+ end
20
+ end
21
+ end