algolia 3.0.0.alpha.10 → 3.0.0.alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.openapi-generator/FILES +2 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/models/recommend/base_search_response.rb +14 -4
- data/lib/algolia/models/recommend/recommendations_results.rb +11 -1
- data/lib/algolia/models/search/api_key_operation.rb +34 -0
- data/lib/algolia/models/search/base_search_response.rb +14 -4
- data/lib/algolia/models/search/browse_response.rb +11 -1
- data/lib/algolia/models/search/search_response.rb +11 -1
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +248 -0
- data/lib/algolia/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c6f55c1f03d70cd3cf974e56e8e38935071b6c897e3e4087dec61daa8e963d7
|
4
|
+
data.tar.gz: ecb224772c31f319bc0327616cfce7a62eef98a6032923bf3e18d85ea8c5c1ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75b06bd1c0690db66603da2fb80d7aef9ef5b194dbcb598210277c26e1dd55688c16c5644a297b9ab22baffd49c040ae548d9ccec9f91c0ec2542b5497f66a0e
|
7
|
+
data.tar.gz: ae90b0e9e4eda6d4b15f2ffa23084af86cf22fd29a7a55066aed0e66d352bfef3546521e8163c6ac1833a47f6aec573f3e94b4458c02f703202c0406d56ea9b2
|
data/.openapi-generator/FILES
CHANGED
@@ -6,6 +6,7 @@ lib/algolia/models/search/advanced_syntax_features.rb
|
|
6
6
|
lib/algolia/models/search/alternatives_as_exact.rb
|
7
7
|
lib/algolia/models/search/anchoring.rb
|
8
8
|
lib/algolia/models/search/api_key.rb
|
9
|
+
lib/algolia/models/search/api_key_operation.rb
|
9
10
|
lib/algolia/models/search/around_precision.rb
|
10
11
|
lib/algolia/models/search/around_precision_from_value_inner.rb
|
11
12
|
lib/algolia/models/search/around_radius.rb
|
@@ -140,6 +141,7 @@ lib/algolia/models/search/search_type_default.rb
|
|
140
141
|
lib/algolia/models/search/search_type_facet.rb
|
141
142
|
lib/algolia/models/search/search_user_ids_params.rb
|
142
143
|
lib/algolia/models/search/search_user_ids_response.rb
|
144
|
+
lib/algolia/models/search/secured_api_key_restrictions.rb
|
143
145
|
lib/algolia/models/search/semantic_search.rb
|
144
146
|
lib/algolia/models/search/snippet_result.rb
|
145
147
|
lib/algolia/models/search/snippet_result_option.rb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## [3.0.0.alpha.11](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.10...3.0.0.alpha.11)
|
2
|
+
|
3
|
+
- [a138c2fef](https://github.com/algolia/api-clients-automation/commit/a138c2fef) fix(specs): add `queryID` to search response ([#2801](https://github.com/algolia/api-clients-automation/pull/2801)) by [@aallam](https://github.com/aallam/)
|
4
|
+
- [6f0b00ead](https://github.com/algolia/api-clients-automation/commit/6f0b00ead) chore(specs): remove JSON specs and new worlds logic ([#2794](https://github.com/algolia/api-clients-automation/pull/2794)) by [@shortcuts](https://github.com/shortcuts/)
|
5
|
+
|
1
6
|
## [3.0.0.alpha.10](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.9...3.0.0.alpha.10)
|
2
7
|
|
3
8
|
- [d48e2f624](https://github.com/algolia/api-clients-automation/commit/d48e2f624) fix(specs): add missing attributes for CT Source update ([#2792](https://github.com/algolia/api-clients-automation/pull/2792)) by [@damcou](https://github.com/damcou/)
|
data/Gemfile.lock
CHANGED
@@ -84,6 +84,9 @@ module Algolia
|
|
84
84
|
# Lets you store custom data in your indices.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
|
+
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
88
|
+
attr_accessor :query_id
|
89
|
+
|
87
90
|
attr_accessor :additional_properties
|
88
91
|
|
89
92
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -115,7 +118,8 @@ module Algolia
|
|
115
118
|
:rendering_content => :renderingContent,
|
116
119
|
:server_time_ms => :serverTimeMS,
|
117
120
|
:server_used => :serverUsed,
|
118
|
-
:user_data => :userData
|
121
|
+
:user_data => :userData,
|
122
|
+
:query_id => :queryID
|
119
123
|
}
|
120
124
|
end
|
121
125
|
|
@@ -153,7 +157,8 @@ module Algolia
|
|
153
157
|
:rendering_content => :RenderingContent,
|
154
158
|
:server_time_ms => :Integer,
|
155
159
|
:server_used => :String,
|
156
|
-
:user_data => :Object
|
160
|
+
:user_data => :Object,
|
161
|
+
:query_id => :String
|
157
162
|
}
|
158
163
|
end
|
159
164
|
|
@@ -293,6 +298,10 @@ module Algolia
|
|
293
298
|
self.user_data = attributes[:user_data]
|
294
299
|
end
|
295
300
|
|
301
|
+
if attributes.key?(:query_id)
|
302
|
+
self.query_id = attributes[:query_id]
|
303
|
+
end
|
304
|
+
|
296
305
|
# add extra attribute to additional_properties
|
297
306
|
self.additional_properties ||= {}
|
298
307
|
self.additional_properties.merge!(attributes.reject { |k, _| self.class.attribute_map.key?(k.to_sym) })
|
@@ -377,7 +386,8 @@ module Algolia
|
|
377
386
|
rendering_content == other.rendering_content &&
|
378
387
|
server_time_ms == other.server_time_ms &&
|
379
388
|
server_used == other.server_used &&
|
380
|
-
user_data == other.user_data
|
389
|
+
user_data == other.user_data &&
|
390
|
+
query_id == other.query_id
|
381
391
|
end
|
382
392
|
|
383
393
|
# @see the `==` method
|
@@ -390,7 +400,7 @@ module Algolia
|
|
390
400
|
# @return [Integer] Hash code
|
391
401
|
def hash
|
392
402
|
[ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
|
393
|
-
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data].hash
|
403
|
+
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id].hash
|
394
404
|
end
|
395
405
|
|
396
406
|
# Builds the object from hash
|
@@ -84,6 +84,9 @@ module Algolia
|
|
84
84
|
# Lets you store custom data in your indices.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
|
+
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
88
|
+
attr_accessor :query_id
|
89
|
+
|
87
90
|
attr_accessor :hits
|
88
91
|
|
89
92
|
# Text to search for in an index.
|
@@ -122,6 +125,7 @@ module Algolia
|
|
122
125
|
:server_time_ms => :serverTimeMS,
|
123
126
|
:server_used => :serverUsed,
|
124
127
|
:user_data => :userData,
|
128
|
+
:query_id => :queryID,
|
125
129
|
:hits => :hits,
|
126
130
|
:query => :query,
|
127
131
|
:params => :params
|
@@ -163,6 +167,7 @@ module Algolia
|
|
163
167
|
:server_time_ms => :Integer,
|
164
168
|
:server_used => :String,
|
165
169
|
:user_data => :Object,
|
170
|
+
:query_id => :String,
|
166
171
|
:hits => :'Array<RecommendationsHit>',
|
167
172
|
:query => :String,
|
168
173
|
:params => :String
|
@@ -321,6 +326,10 @@ module Algolia
|
|
321
326
|
self.user_data = attributes[:user_data]
|
322
327
|
end
|
323
328
|
|
329
|
+
if attributes.key?(:query_id)
|
330
|
+
self.query_id = attributes[:query_id]
|
331
|
+
end
|
332
|
+
|
324
333
|
if attributes.key?(:hits)
|
325
334
|
if (value = attributes[:hits]).is_a?(Array)
|
326
335
|
self.hits = value
|
@@ -418,6 +427,7 @@ module Algolia
|
|
418
427
|
server_time_ms == other.server_time_ms &&
|
419
428
|
server_used == other.server_used &&
|
420
429
|
user_data == other.user_data &&
|
430
|
+
query_id == other.query_id &&
|
421
431
|
hits == other.hits &&
|
422
432
|
query == other.query &&
|
423
433
|
params == other.params
|
@@ -433,7 +443,7 @@ module Algolia
|
|
433
443
|
# @return [Integer] Hash code
|
434
444
|
def hash
|
435
445
|
[ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
|
436
|
-
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, hits, query, params].hash
|
446
|
+
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits, query, params].hash
|
437
447
|
end
|
438
448
|
|
439
449
|
# Builds the object from hash
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'time'
|
5
|
+
|
6
|
+
module Algolia
|
7
|
+
module Search
|
8
|
+
class ApiKeyOperation
|
9
|
+
ADD = "add".freeze
|
10
|
+
DELETE = "delete".freeze
|
11
|
+
UPDATE = "update".freeze
|
12
|
+
|
13
|
+
def self.all_vars
|
14
|
+
@all_vars ||= [ADD, DELETE, UPDATE].freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
# Builds the enum from string
|
18
|
+
# @param [String] The enum value in the form of the string
|
19
|
+
# @return [String] The enum value
|
20
|
+
def self.build_from_hash(value)
|
21
|
+
new.build_from_hash(value)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Builds the enum from string
|
25
|
+
# @param [String] The enum value in the form of the string
|
26
|
+
# @return [String] The enum value
|
27
|
+
def build_from_hash(value)
|
28
|
+
return value if ApiKeyOperation.all_vars.include?(value)
|
29
|
+
|
30
|
+
raise "Invalid ENUM value #{value} for class #ApiKeyOperation"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -84,6 +84,9 @@ module Algolia
|
|
84
84
|
# Lets you store custom data in your indices.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
|
+
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
88
|
+
attr_accessor :query_id
|
89
|
+
|
87
90
|
attr_accessor :additional_properties
|
88
91
|
|
89
92
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -115,7 +118,8 @@ module Algolia
|
|
115
118
|
:rendering_content => :renderingContent,
|
116
119
|
:server_time_ms => :serverTimeMS,
|
117
120
|
:server_used => :serverUsed,
|
118
|
-
:user_data => :userData
|
121
|
+
:user_data => :userData,
|
122
|
+
:query_id => :queryID
|
119
123
|
}
|
120
124
|
end
|
121
125
|
|
@@ -153,7 +157,8 @@ module Algolia
|
|
153
157
|
:rendering_content => :RenderingContent,
|
154
158
|
:server_time_ms => :Integer,
|
155
159
|
:server_used => :String,
|
156
|
-
:user_data => :Object
|
160
|
+
:user_data => :Object,
|
161
|
+
:query_id => :String
|
157
162
|
}
|
158
163
|
end
|
159
164
|
|
@@ -293,6 +298,10 @@ module Algolia
|
|
293
298
|
self.user_data = attributes[:user_data]
|
294
299
|
end
|
295
300
|
|
301
|
+
if attributes.key?(:query_id)
|
302
|
+
self.query_id = attributes[:query_id]
|
303
|
+
end
|
304
|
+
|
296
305
|
# add extra attribute to additional_properties
|
297
306
|
self.additional_properties ||= {}
|
298
307
|
self.additional_properties.merge!(attributes.reject { |k, _| self.class.attribute_map.key?(k.to_sym) })
|
@@ -377,7 +386,8 @@ module Algolia
|
|
377
386
|
rendering_content == other.rendering_content &&
|
378
387
|
server_time_ms == other.server_time_ms &&
|
379
388
|
server_used == other.server_used &&
|
380
|
-
user_data == other.user_data
|
389
|
+
user_data == other.user_data &&
|
390
|
+
query_id == other.query_id
|
381
391
|
end
|
382
392
|
|
383
393
|
# @see the `==` method
|
@@ -390,7 +400,7 @@ module Algolia
|
|
390
400
|
# @return [Integer] Hash code
|
391
401
|
def hash
|
392
402
|
[ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
|
393
|
-
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data].hash
|
403
|
+
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id].hash
|
394
404
|
end
|
395
405
|
|
396
406
|
# Builds the object from hash
|
@@ -84,6 +84,9 @@ module Algolia
|
|
84
84
|
# Lets you store custom data in your indices.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
|
+
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
88
|
+
attr_accessor :query_id
|
89
|
+
|
87
90
|
attr_accessor :hits
|
88
91
|
|
89
92
|
# Text to search for in an index.
|
@@ -125,6 +128,7 @@ module Algolia
|
|
125
128
|
:server_time_ms => :serverTimeMS,
|
126
129
|
:server_used => :serverUsed,
|
127
130
|
:user_data => :userData,
|
131
|
+
:query_id => :queryID,
|
128
132
|
:hits => :hits,
|
129
133
|
:query => :query,
|
130
134
|
:params => :params,
|
@@ -167,6 +171,7 @@ module Algolia
|
|
167
171
|
:server_time_ms => :Integer,
|
168
172
|
:server_used => :String,
|
169
173
|
:user_data => :Object,
|
174
|
+
:query_id => :String,
|
170
175
|
:hits => :'Array<Hit>',
|
171
176
|
:query => :String,
|
172
177
|
:params => :String,
|
@@ -327,6 +332,10 @@ module Algolia
|
|
327
332
|
self.user_data = attributes[:user_data]
|
328
333
|
end
|
329
334
|
|
335
|
+
if attributes.key?(:query_id)
|
336
|
+
self.query_id = attributes[:query_id]
|
337
|
+
end
|
338
|
+
|
330
339
|
if attributes.key?(:hits)
|
331
340
|
if (value = attributes[:hits]).is_a?(Array)
|
332
341
|
self.hits = value
|
@@ -432,6 +441,7 @@ module Algolia
|
|
432
441
|
server_time_ms == other.server_time_ms &&
|
433
442
|
server_used == other.server_used &&
|
434
443
|
user_data == other.user_data &&
|
444
|
+
query_id == other.query_id &&
|
435
445
|
hits == other.hits &&
|
436
446
|
query == other.query &&
|
437
447
|
params == other.params &&
|
@@ -448,7 +458,7 @@ module Algolia
|
|
448
458
|
# @return [Integer] Hash code
|
449
459
|
def hash
|
450
460
|
[ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
|
451
|
-
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, hits, query, params, cursor].hash
|
461
|
+
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits, query, params, cursor].hash
|
452
462
|
end
|
453
463
|
|
454
464
|
# Builds the object from hash
|
@@ -84,6 +84,9 @@ module Algolia
|
|
84
84
|
# Lets you store custom data in your indices.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
|
+
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
88
|
+
attr_accessor :query_id
|
89
|
+
|
87
90
|
attr_accessor :hits
|
88
91
|
|
89
92
|
# Text to search for in an index.
|
@@ -124,6 +127,7 @@ module Algolia
|
|
124
127
|
:server_time_ms => :serverTimeMS,
|
125
128
|
:server_used => :serverUsed,
|
126
129
|
:user_data => :userData,
|
130
|
+
:query_id => :queryID,
|
127
131
|
:hits => :hits,
|
128
132
|
:query => :query,
|
129
133
|
:params => :params
|
@@ -165,6 +169,7 @@ module Algolia
|
|
165
169
|
:server_time_ms => :Integer,
|
166
170
|
:server_used => :String,
|
167
171
|
:user_data => :Object,
|
172
|
+
:query_id => :String,
|
168
173
|
:hits => :'Array<Hit>',
|
169
174
|
:query => :String,
|
170
175
|
:params => :String
|
@@ -313,6 +318,10 @@ module Algolia
|
|
313
318
|
self.user_data = attributes[:user_data]
|
314
319
|
end
|
315
320
|
|
321
|
+
if attributes.key?(:query_id)
|
322
|
+
self.query_id = attributes[:query_id]
|
323
|
+
end
|
324
|
+
|
316
325
|
if attributes.key?(:hits)
|
317
326
|
if (value = attributes[:hits]).is_a?(Array)
|
318
327
|
self.hits = value
|
@@ -418,6 +427,7 @@ module Algolia
|
|
418
427
|
server_time_ms == other.server_time_ms &&
|
419
428
|
server_used == other.server_used &&
|
420
429
|
user_data == other.user_data &&
|
430
|
+
query_id == other.query_id &&
|
421
431
|
hits == other.hits &&
|
422
432
|
query == other.query &&
|
423
433
|
params == other.params
|
@@ -433,7 +443,7 @@ module Algolia
|
|
433
443
|
# @return [Integer] Hash code
|
434
444
|
def hash
|
435
445
|
[ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
|
436
|
-
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, hits, query, params].hash
|
446
|
+
hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits, query, params].hash
|
437
447
|
end
|
438
448
|
|
439
449
|
# Builds the object from hash
|
@@ -0,0 +1,248 @@
|
|
1
|
+
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'time'
|
5
|
+
|
6
|
+
module Algolia
|
7
|
+
module Search
|
8
|
+
class SecuredAPIKeyRestrictions
|
9
|
+
attr_accessor :search_params
|
10
|
+
|
11
|
+
# Filters that apply to every search made with the secured API key. You can add extra filters at search time with the filters query parameter. For example, if you set the filter group:admin on your generated API key, and you add groups:press OR groups:visitors with the filters query parameter, your final search filter is equivalent to groups:admin AND (groups:press OR groups:visitors).
|
12
|
+
attr_accessor :filters
|
13
|
+
|
14
|
+
# Unix timestamp used to set the expiration date of the API key.
|
15
|
+
attr_accessor :valid_until
|
16
|
+
|
17
|
+
# Index names that can be queried.
|
18
|
+
attr_accessor :restrict_indices
|
19
|
+
|
20
|
+
# IPv4 network allowed to use the generated key. Use this to protect against API key leaking and reuse. You can only provide a single source, but you can specify a range of IPs (for example, 192.168.1.0/24).
|
21
|
+
attr_accessor :restrict_sources
|
22
|
+
|
23
|
+
# Unique user IP address. This can be useful when you want to impose a rate limit on specific users. By default, rate limits are set based on the IP address. This can become an issue when several users search from the same IP address. To avoid this, you can set a unique userToken for each user when generating their API key. This lets you restrict each user to a maximum number of API calls per hour, even if they share their IP with another user. Specifying the userToken in a secured API key is also a good security practice as it ensures users don't change it. Many features like Analytics, Personalization, and Dynamic Re-ranking rely on the authenticity of user identifiers. Setting the userToken at the API key level ensures that downstream services work as expected and prevents abuse.
|
24
|
+
attr_accessor :user_token
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:search_params => :searchParams,
|
30
|
+
:filters => :filters,
|
31
|
+
:valid_until => :validUntil,
|
32
|
+
:restrict_indices => :restrictIndices,
|
33
|
+
:restrict_sources => :restrictSources,
|
34
|
+
:user_token => :userToken
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns all the JSON keys this model knows about
|
39
|
+
def self.acceptable_attributes
|
40
|
+
attribute_map.values
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.types_mapping
|
45
|
+
{
|
46
|
+
:search_params => :SearchParamsObject,
|
47
|
+
:filters => :String,
|
48
|
+
:valid_until => :Integer,
|
49
|
+
:restrict_indices => :'Array<String>',
|
50
|
+
:restrict_sources => :String,
|
51
|
+
:user_token => :String
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# List of attributes with nullable: true
|
56
|
+
def self.openapi_nullable
|
57
|
+
Set.new([])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
unless attributes.is_a?(Hash)
|
64
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SecuredAPIKeyRestrictions` initialize method"
|
65
|
+
end
|
66
|
+
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
69
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
70
|
+
raise ArgumentError,
|
71
|
+
"`#{k}` is not a valid attribute in `Algolia::SecuredAPIKeyRestrictions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
|
+
end
|
73
|
+
|
74
|
+
h[k.to_sym] = v
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:search_params)
|
78
|
+
self.search_params = attributes[:search_params]
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:filters)
|
82
|
+
self.filters = attributes[:filters]
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:valid_until)
|
86
|
+
self.valid_until = attributes[:valid_until]
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:restrict_indices)
|
90
|
+
if (value = attributes[:restrict_indices]).is_a?(Array)
|
91
|
+
self.restrict_indices = value
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:restrict_sources)
|
96
|
+
self.restrict_sources = attributes[:restrict_sources]
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:user_token)
|
100
|
+
self.user_token = attributes[:user_token]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Checks equality by comparing each attribute.
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def ==(other)
|
107
|
+
return true if equal?(other)
|
108
|
+
|
109
|
+
self.class == other.class &&
|
110
|
+
search_params == other.search_params &&
|
111
|
+
filters == other.filters &&
|
112
|
+
valid_until == other.valid_until &&
|
113
|
+
restrict_indices == other.restrict_indices &&
|
114
|
+
restrict_sources == other.restrict_sources &&
|
115
|
+
user_token == other.user_token
|
116
|
+
end
|
117
|
+
|
118
|
+
# @see the `==` method
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def eql?(other)
|
121
|
+
self == other
|
122
|
+
end
|
123
|
+
|
124
|
+
# Calculates hash code according to all attributes.
|
125
|
+
# @return [Integer] Hash code
|
126
|
+
def hash
|
127
|
+
[search_params, filters, valid_until, restrict_indices, restrict_sources, user_token].hash
|
128
|
+
end
|
129
|
+
|
130
|
+
# Builds the object from hash
|
131
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
132
|
+
# @return [Object] Returns the model itself
|
133
|
+
def self.build_from_hash(attributes)
|
134
|
+
return nil unless attributes.is_a?(Hash)
|
135
|
+
|
136
|
+
attributes = attributes.transform_keys(&:to_sym)
|
137
|
+
transformed_hash = {}
|
138
|
+
types_mapping.each_pair do |key, type|
|
139
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
140
|
+
transformed_hash[key.to_sym] = nil
|
141
|
+
elsif type =~ /\AArray<(.*)>/i
|
142
|
+
# check to ensure the input is an array given that the attribute
|
143
|
+
# is documented as an array but the input is not
|
144
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
145
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
146
|
+
end
|
147
|
+
elsif !attributes[attribute_map[key]].nil?
|
148
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
149
|
+
end
|
150
|
+
end
|
151
|
+
new(transformed_hash)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Deserializes the data based on type
|
155
|
+
# @param string type Data type
|
156
|
+
# @param string value Value to be deserialized
|
157
|
+
# @return [Object] Deserialized data
|
158
|
+
def self._deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :Time
|
161
|
+
Time.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :Boolean
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when :Object
|
177
|
+
# generic object (usually a Hash), return directly
|
178
|
+
value
|
179
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
180
|
+
inner_type = Regexp.last_match[:inner_type]
|
181
|
+
value.map { |v| _deserialize(inner_type, v) }
|
182
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
183
|
+
k_type = Regexp.last_match[:k_type]
|
184
|
+
v_type = Regexp.last_match[:v_type]
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each do |k, v|
|
187
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
else # model
|
191
|
+
# models (e.g. Pet) or oneOf
|
192
|
+
klass = Algolia::Search.const_get(type)
|
193
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
def to_json(*_args)
|
210
|
+
to_hash.to_json
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the object in the form of hash
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_hash
|
216
|
+
hash = {}
|
217
|
+
self.class.attribute_map.each_pair do |attr, param|
|
218
|
+
value = send(attr)
|
219
|
+
if value.nil?
|
220
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
221
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
222
|
+
end
|
223
|
+
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map { |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
data/lib/algolia/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
2
2
|
|
3
3
|
module Algolia
|
4
|
-
VERSION = '3.0.0.alpha.
|
4
|
+
VERSION = '3.0.0.alpha.11'.freeze
|
5
5
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algolia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -474,6 +474,7 @@ files:
|
|
474
474
|
- lib/algolia/models/search/alternatives_as_exact.rb
|
475
475
|
- lib/algolia/models/search/anchoring.rb
|
476
476
|
- lib/algolia/models/search/api_key.rb
|
477
|
+
- lib/algolia/models/search/api_key_operation.rb
|
477
478
|
- lib/algolia/models/search/around_precision.rb
|
478
479
|
- lib/algolia/models/search/around_precision_from_value_inner.rb
|
479
480
|
- lib/algolia/models/search/around_radius.rb
|
@@ -608,6 +609,7 @@ files:
|
|
608
609
|
- lib/algolia/models/search/search_type_facet.rb
|
609
610
|
- lib/algolia/models/search/search_user_ids_params.rb
|
610
611
|
- lib/algolia/models/search/search_user_ids_response.rb
|
612
|
+
- lib/algolia/models/search/secured_api_key_restrictions.rb
|
611
613
|
- lib/algolia/models/search/semantic_search.rb
|
612
614
|
- lib/algolia/models/search/snippet_result.rb
|
613
615
|
- lib/algolia/models/search/snippet_result_option.rb
|