algolia 3.39.1 → 3.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +1 -1
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/ingestion_client.rb +71 -0
- data/lib/algolia/api/search_client.rb +342 -22
- data/lib/algolia/chunked_helper_options.rb +15 -0
- data/lib/algolia/configuration.rb +3 -1
- data/lib/algolia/models/abtesting/ab_test.rb +5 -0
- data/lib/algolia/models/query-suggestions/configuration.rb +1 -0
- data/lib/algolia/models/query-suggestions/configuration_response.rb +1 -0
- data/lib/algolia/models/query-suggestions/configuration_with_index.rb +1 -0
- data/lib/algolia/models/query-suggestions/source_index.rb +4 -0
- data/lib/algolia/models/recommend/fallback_params.rb +2 -1
- data/lib/algolia/models/recommend/recommend_search_params.rb +2 -1
- data/lib/algolia/models/search/browse_params_object.rb +2 -1
- data/lib/algolia/models/search/consequence_params.rb +2 -1
- data/lib/algolia/models/search/fetched_index.rb +25 -4
- data/lib/algolia/models/search/fetched_index_ab_test.rb +253 -0
- data/lib/algolia/models/search/fetched_index_ab_test_target.rb +210 -0
- data/lib/algolia/models/search/fetched_index_ab_test_variant.rb +242 -0
- data/lib/algolia/models/search/index_settings.rb +2 -1
- data/lib/algolia/models/search/search_for_facets.rb +2 -1
- data/lib/algolia/models/search/search_for_hits.rb +2 -1
- data/lib/algolia/models/search/search_params_object.rb +2 -1
- data/lib/algolia/models/search/search_response_partial.rb +587 -0
- data/lib/algolia/models/search/search_result.rb +2 -1
- data/lib/algolia/models/search/settings_response.rb +2 -1
- data/lib/algolia/version.rb +1 -1
- data/lib/algolia.rb +1 -2
- metadata +7 -2
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# 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.
|
|
4
|
+
|
|
5
|
+
require "date"
|
|
6
|
+
require "time"
|
|
7
|
+
|
|
8
|
+
module Algolia
|
|
9
|
+
module Search
|
|
10
|
+
# Partial search response returned when the `responseFields` parameter excludes fields like `hits`. Contains all possible search response properties but none are required, so it acts as an unconditional fallback during oneOf deserialization.
|
|
11
|
+
class SearchResponsePartial
|
|
12
|
+
# A/B test ID. This is only included in the response for indices that are part of an A/B test.
|
|
13
|
+
attr_accessor :ab_test_id
|
|
14
|
+
|
|
15
|
+
# Variant ID. This is only included in the response for indices that are part of an A/B test.
|
|
16
|
+
attr_accessor :ab_test_variant_id
|
|
17
|
+
|
|
18
|
+
# Computed geographical location.
|
|
19
|
+
attr_accessor :around_lat_lng
|
|
20
|
+
|
|
21
|
+
# Distance from a central coordinate provided by `aroundLatLng`.
|
|
22
|
+
attr_accessor :automatic_radius
|
|
23
|
+
|
|
24
|
+
attr_accessor :exhaustive
|
|
25
|
+
|
|
26
|
+
# Rules applied to the query.
|
|
27
|
+
attr_accessor :applied_rules
|
|
28
|
+
|
|
29
|
+
# See the `facetsCount` field of the `exhaustive` object in the response.
|
|
30
|
+
attr_accessor :exhaustive_facets_count
|
|
31
|
+
|
|
32
|
+
# See the `nbHits` field of the `exhaustive` object in the response.
|
|
33
|
+
attr_accessor :exhaustive_nb_hits
|
|
34
|
+
|
|
35
|
+
# See the `typo` field of the `exhaustive` object in the response.
|
|
36
|
+
attr_accessor :exhaustive_typo
|
|
37
|
+
|
|
38
|
+
# Facet counts.
|
|
39
|
+
attr_accessor :facets
|
|
40
|
+
|
|
41
|
+
# Statistics for numerical facets.
|
|
42
|
+
attr_accessor :facets_stats
|
|
43
|
+
|
|
44
|
+
# Index name used for the query.
|
|
45
|
+
attr_accessor :index
|
|
46
|
+
|
|
47
|
+
# Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.
|
|
48
|
+
attr_accessor :index_used
|
|
49
|
+
|
|
50
|
+
# Warnings about the query.
|
|
51
|
+
attr_accessor :message
|
|
52
|
+
|
|
53
|
+
# Number of hits selected and sorted by the relevant sort algorithm.
|
|
54
|
+
attr_accessor :nb_sorted_hits
|
|
55
|
+
|
|
56
|
+
# Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.
|
|
57
|
+
attr_accessor :parsed_query
|
|
58
|
+
|
|
59
|
+
# Time the server took to process the request, in milliseconds.
|
|
60
|
+
attr_accessor :processing_time_ms
|
|
61
|
+
|
|
62
|
+
# Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
|
|
63
|
+
attr_accessor :processing_timings_ms
|
|
64
|
+
|
|
65
|
+
# Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
|
|
66
|
+
attr_accessor :query_after_removal
|
|
67
|
+
|
|
68
|
+
attr_accessor :redirect
|
|
69
|
+
|
|
70
|
+
attr_accessor :rendering_content
|
|
71
|
+
|
|
72
|
+
# Time the server took to process the request, in milliseconds.
|
|
73
|
+
attr_accessor :server_time_ms
|
|
74
|
+
|
|
75
|
+
# Host name of the server that processed the request.
|
|
76
|
+
attr_accessor :server_used
|
|
77
|
+
|
|
78
|
+
# An object with custom data. You can store up to 32kB as custom data.
|
|
79
|
+
attr_accessor :user_data
|
|
80
|
+
|
|
81
|
+
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics).
|
|
82
|
+
attr_accessor :query_id
|
|
83
|
+
|
|
84
|
+
# Whether automatic events collection is enabled for the application.
|
|
85
|
+
attr_accessor :_automatic_insights
|
|
86
|
+
|
|
87
|
+
# Page of search results to retrieve.
|
|
88
|
+
attr_accessor :page
|
|
89
|
+
|
|
90
|
+
# Number of results (hits).
|
|
91
|
+
attr_accessor :nb_hits
|
|
92
|
+
|
|
93
|
+
# Number of pages of results.
|
|
94
|
+
attr_accessor :nb_pages
|
|
95
|
+
|
|
96
|
+
# Number of hits per page.
|
|
97
|
+
attr_accessor :hits_per_page
|
|
98
|
+
|
|
99
|
+
# Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
|
|
100
|
+
attr_accessor :hits
|
|
101
|
+
|
|
102
|
+
# Search query.
|
|
103
|
+
attr_accessor :query
|
|
104
|
+
|
|
105
|
+
# URL-encoded string of all search parameters.
|
|
106
|
+
attr_accessor :params
|
|
107
|
+
|
|
108
|
+
attr_accessor :extensions
|
|
109
|
+
|
|
110
|
+
attr_accessor :additional_properties
|
|
111
|
+
|
|
112
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
113
|
+
def self.attribute_map
|
|
114
|
+
{
|
|
115
|
+
:ab_test_id => :abTestID,
|
|
116
|
+
:ab_test_variant_id => :abTestVariantID,
|
|
117
|
+
:around_lat_lng => :aroundLatLng,
|
|
118
|
+
:automatic_radius => :automaticRadius,
|
|
119
|
+
:exhaustive => :exhaustive,
|
|
120
|
+
:applied_rules => :appliedRules,
|
|
121
|
+
:exhaustive_facets_count => :exhaustiveFacetsCount,
|
|
122
|
+
:exhaustive_nb_hits => :exhaustiveNbHits,
|
|
123
|
+
:exhaustive_typo => :exhaustiveTypo,
|
|
124
|
+
:facets => :facets,
|
|
125
|
+
:facets_stats => :facets_stats,
|
|
126
|
+
:index => :index,
|
|
127
|
+
:index_used => :indexUsed,
|
|
128
|
+
:message => :message,
|
|
129
|
+
:nb_sorted_hits => :nbSortedHits,
|
|
130
|
+
:parsed_query => :parsedQuery,
|
|
131
|
+
:processing_time_ms => :processingTimeMS,
|
|
132
|
+
:processing_timings_ms => :processingTimingsMS,
|
|
133
|
+
:query_after_removal => :queryAfterRemoval,
|
|
134
|
+
:redirect => :redirect,
|
|
135
|
+
:rendering_content => :renderingContent,
|
|
136
|
+
:server_time_ms => :serverTimeMS,
|
|
137
|
+
:server_used => :serverUsed,
|
|
138
|
+
:user_data => :userData,
|
|
139
|
+
:query_id => :queryID,
|
|
140
|
+
:_automatic_insights => :_automaticInsights,
|
|
141
|
+
:page => :page,
|
|
142
|
+
:nb_hits => :nbHits,
|
|
143
|
+
:nb_pages => :nbPages,
|
|
144
|
+
:hits_per_page => :hitsPerPage,
|
|
145
|
+
:hits => :hits,
|
|
146
|
+
:query => :query,
|
|
147
|
+
:params => :params,
|
|
148
|
+
:extensions => :extensions
|
|
149
|
+
}
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Attribute type mapping.
|
|
153
|
+
def self.types_mapping
|
|
154
|
+
{
|
|
155
|
+
:ab_test_id => :"Integer",
|
|
156
|
+
:ab_test_variant_id => :"Integer",
|
|
157
|
+
:around_lat_lng => :"String",
|
|
158
|
+
:automatic_radius => :"String",
|
|
159
|
+
:exhaustive => :"Exhaustive",
|
|
160
|
+
:applied_rules => :"Array<Object>",
|
|
161
|
+
:exhaustive_facets_count => :"Boolean",
|
|
162
|
+
:exhaustive_nb_hits => :"Boolean",
|
|
163
|
+
:exhaustive_typo => :"Boolean",
|
|
164
|
+
:facets => :"Hash<String, Hash<String, Integer>>",
|
|
165
|
+
:facets_stats => :"Hash<String, FacetStats>",
|
|
166
|
+
:index => :"String",
|
|
167
|
+
:index_used => :"String",
|
|
168
|
+
:message => :"String",
|
|
169
|
+
:nb_sorted_hits => :"Integer",
|
|
170
|
+
:parsed_query => :"String",
|
|
171
|
+
:processing_time_ms => :"Integer",
|
|
172
|
+
:processing_timings_ms => :"Object",
|
|
173
|
+
:query_after_removal => :"String",
|
|
174
|
+
:redirect => :"Redirect",
|
|
175
|
+
:rendering_content => :"RenderingContent",
|
|
176
|
+
:server_time_ms => :"Integer",
|
|
177
|
+
:server_used => :"String",
|
|
178
|
+
:user_data => :"Object",
|
|
179
|
+
:query_id => :"String",
|
|
180
|
+
:_automatic_insights => :"Boolean",
|
|
181
|
+
:page => :"Integer",
|
|
182
|
+
:nb_hits => :"Integer",
|
|
183
|
+
:nb_pages => :"Integer",
|
|
184
|
+
:hits_per_page => :"Integer",
|
|
185
|
+
:hits => :"Array<Hit>",
|
|
186
|
+
:query => :"String",
|
|
187
|
+
:params => :"String",
|
|
188
|
+
:extensions => :"ResponseExtensions"
|
|
189
|
+
}
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# List of attributes with nullable: true
|
|
193
|
+
def self.openapi_nullable
|
|
194
|
+
Set.new(
|
|
195
|
+
[
|
|
196
|
+
:user_data
|
|
197
|
+
]
|
|
198
|
+
)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
202
|
+
def self.openapi_all_of
|
|
203
|
+
[
|
|
204
|
+
:"BaseSearchResponse",
|
|
205
|
+
:"SearchPagination"
|
|
206
|
+
]
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Initializes the object
|
|
210
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
211
|
+
def initialize(attributes = {})
|
|
212
|
+
if (!attributes.is_a?(Hash))
|
|
213
|
+
raise(
|
|
214
|
+
ArgumentError,
|
|
215
|
+
"The input argument (attributes) must be a hash in `Algolia::SearchResponsePartial` initialize method"
|
|
216
|
+
)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if attributes.key?(:ab_test_id)
|
|
220
|
+
self.ab_test_id = attributes[:ab_test_id]
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if attributes.key?(:ab_test_variant_id)
|
|
224
|
+
self.ab_test_variant_id = attributes[:ab_test_variant_id]
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:around_lat_lng)
|
|
228
|
+
self.around_lat_lng = attributes[:around_lat_lng]
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if attributes.key?(:automatic_radius)
|
|
232
|
+
self.automatic_radius = attributes[:automatic_radius]
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if attributes.key?(:exhaustive)
|
|
236
|
+
self.exhaustive = attributes[:exhaustive]
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
if attributes.key?(:applied_rules)
|
|
240
|
+
if (value = attributes[:applied_rules]).is_a?(Array)
|
|
241
|
+
self.applied_rules = value
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if attributes.key?(:exhaustive_facets_count)
|
|
246
|
+
self.exhaustive_facets_count = attributes[:exhaustive_facets_count]
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if attributes.key?(:exhaustive_nb_hits)
|
|
250
|
+
self.exhaustive_nb_hits = attributes[:exhaustive_nb_hits]
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if attributes.key?(:exhaustive_typo)
|
|
254
|
+
self.exhaustive_typo = attributes[:exhaustive_typo]
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
if attributes.key?(:facets)
|
|
258
|
+
if (value = attributes[:facets]).is_a?(Hash)
|
|
259
|
+
self.facets = value
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
if attributes.key?(:facets_stats)
|
|
264
|
+
if (value = attributes[:facets_stats]).is_a?(Hash)
|
|
265
|
+
self.facets_stats = value
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if attributes.key?(:index)
|
|
270
|
+
self.index = attributes[:index]
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if attributes.key?(:index_used)
|
|
274
|
+
self.index_used = attributes[:index_used]
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
if attributes.key?(:message)
|
|
278
|
+
self.message = attributes[:message]
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
if attributes.key?(:nb_sorted_hits)
|
|
282
|
+
self.nb_sorted_hits = attributes[:nb_sorted_hits]
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if attributes.key?(:parsed_query)
|
|
286
|
+
self.parsed_query = attributes[:parsed_query]
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
if attributes.key?(:processing_time_ms)
|
|
290
|
+
self.processing_time_ms = attributes[:processing_time_ms]
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
if attributes.key?(:processing_timings_ms)
|
|
294
|
+
self.processing_timings_ms = attributes[:processing_timings_ms]
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
if attributes.key?(:query_after_removal)
|
|
298
|
+
self.query_after_removal = attributes[:query_after_removal]
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
if attributes.key?(:redirect)
|
|
302
|
+
self.redirect = attributes[:redirect]
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
if attributes.key?(:rendering_content)
|
|
306
|
+
self.rendering_content = attributes[:rendering_content]
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
if attributes.key?(:server_time_ms)
|
|
310
|
+
self.server_time_ms = attributes[:server_time_ms]
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
if attributes.key?(:server_used)
|
|
314
|
+
self.server_used = attributes[:server_used]
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
if attributes.key?(:user_data)
|
|
318
|
+
self.user_data = attributes[:user_data]
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
if attributes.key?(:query_id)
|
|
322
|
+
self.query_id = attributes[:query_id]
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
if attributes.key?(:_automatic_insights)
|
|
326
|
+
self._automatic_insights = attributes[:_automatic_insights]
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
if attributes.key?(:page)
|
|
330
|
+
self.page = attributes[:page]
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
if attributes.key?(:nb_hits)
|
|
334
|
+
self.nb_hits = attributes[:nb_hits]
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
if attributes.key?(:nb_pages)
|
|
338
|
+
self.nb_pages = attributes[:nb_pages]
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
if attributes.key?(:hits_per_page)
|
|
342
|
+
self.hits_per_page = attributes[:hits_per_page]
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
if attributes.key?(:hits)
|
|
346
|
+
if (value = attributes[:hits]).is_a?(Array)
|
|
347
|
+
self.hits = value
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
if attributes.key?(:query)
|
|
352
|
+
self.query = attributes[:query]
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
if attributes.key?(:params)
|
|
356
|
+
self.params = attributes[:params]
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
if attributes.key?(:extensions)
|
|
360
|
+
self.extensions = attributes[:extensions]
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# add extra attribute to additional_properties
|
|
364
|
+
self.additional_properties ||= {}
|
|
365
|
+
self.additional_properties.merge!(attributes.reject { |k, _| self.class.attribute_map.key?(k.to_sym) })
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Checks equality by comparing each attribute.
|
|
369
|
+
# @param [Object] Object to be compared
|
|
370
|
+
def ==(other)
|
|
371
|
+
return true if self.equal?(other)
|
|
372
|
+
self.class == other.class &&
|
|
373
|
+
ab_test_id == other.ab_test_id &&
|
|
374
|
+
ab_test_variant_id == other.ab_test_variant_id &&
|
|
375
|
+
around_lat_lng == other.around_lat_lng &&
|
|
376
|
+
automatic_radius == other.automatic_radius &&
|
|
377
|
+
exhaustive == other.exhaustive &&
|
|
378
|
+
applied_rules == other.applied_rules &&
|
|
379
|
+
exhaustive_facets_count == other.exhaustive_facets_count &&
|
|
380
|
+
exhaustive_nb_hits == other.exhaustive_nb_hits &&
|
|
381
|
+
exhaustive_typo == other.exhaustive_typo &&
|
|
382
|
+
facets == other.facets &&
|
|
383
|
+
facets_stats == other.facets_stats &&
|
|
384
|
+
index == other.index &&
|
|
385
|
+
index_used == other.index_used &&
|
|
386
|
+
message == other.message &&
|
|
387
|
+
nb_sorted_hits == other.nb_sorted_hits &&
|
|
388
|
+
parsed_query == other.parsed_query &&
|
|
389
|
+
processing_time_ms == other.processing_time_ms &&
|
|
390
|
+
processing_timings_ms == other.processing_timings_ms &&
|
|
391
|
+
query_after_removal == other.query_after_removal &&
|
|
392
|
+
redirect == other.redirect &&
|
|
393
|
+
rendering_content == other.rendering_content &&
|
|
394
|
+
server_time_ms == other.server_time_ms &&
|
|
395
|
+
server_used == other.server_used &&
|
|
396
|
+
user_data == other.user_data &&
|
|
397
|
+
query_id == other.query_id &&
|
|
398
|
+
_automatic_insights == other._automatic_insights &&
|
|
399
|
+
page == other.page &&
|
|
400
|
+
nb_hits == other.nb_hits &&
|
|
401
|
+
nb_pages == other.nb_pages &&
|
|
402
|
+
hits_per_page == other.hits_per_page &&
|
|
403
|
+
hits == other.hits &&
|
|
404
|
+
query == other.query &&
|
|
405
|
+
params == other.params &&
|
|
406
|
+
extensions == other.extensions
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
# @see the `==` method
|
|
410
|
+
# @param [Object] Object to be compared
|
|
411
|
+
def eql?(other)
|
|
412
|
+
self == other
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
# Calculates hash code according to all attributes.
|
|
416
|
+
# @return [Integer] Hash code
|
|
417
|
+
def hash
|
|
418
|
+
[
|
|
419
|
+
ab_test_id,
|
|
420
|
+
ab_test_variant_id,
|
|
421
|
+
around_lat_lng,
|
|
422
|
+
automatic_radius,
|
|
423
|
+
exhaustive,
|
|
424
|
+
applied_rules,
|
|
425
|
+
exhaustive_facets_count,
|
|
426
|
+
exhaustive_nb_hits,
|
|
427
|
+
exhaustive_typo,
|
|
428
|
+
facets,
|
|
429
|
+
facets_stats,
|
|
430
|
+
index,
|
|
431
|
+
index_used,
|
|
432
|
+
message,
|
|
433
|
+
nb_sorted_hits,
|
|
434
|
+
parsed_query,
|
|
435
|
+
processing_time_ms,
|
|
436
|
+
processing_timings_ms,
|
|
437
|
+
query_after_removal,
|
|
438
|
+
redirect,
|
|
439
|
+
rendering_content,
|
|
440
|
+
server_time_ms,
|
|
441
|
+
server_used,
|
|
442
|
+
user_data,
|
|
443
|
+
query_id,
|
|
444
|
+
_automatic_insights,
|
|
445
|
+
page,
|
|
446
|
+
nb_hits,
|
|
447
|
+
nb_pages,
|
|
448
|
+
hits_per_page,
|
|
449
|
+
hits,
|
|
450
|
+
query,
|
|
451
|
+
params,
|
|
452
|
+
extensions
|
|
453
|
+
].hash
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
# Builds the object from hash
|
|
457
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
458
|
+
# @return [Object] Returns the model itself
|
|
459
|
+
def self.build_from_hash(attributes)
|
|
460
|
+
return nil unless attributes.is_a?(Hash)
|
|
461
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
462
|
+
transformed_hash = {}
|
|
463
|
+
types_mapping.each_pair do |key, type|
|
|
464
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
465
|
+
transformed_hash[key.to_sym] = nil
|
|
466
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
467
|
+
# check to ensure the input is an array given that the attribute
|
|
468
|
+
# is documented as an array but the input is not
|
|
469
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
470
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
471
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
472
|
+
}
|
|
473
|
+
end
|
|
474
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
475
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
# add extra attribute to transformed_hash
|
|
480
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
481
|
+
new(transformed_hash)
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
# Deserializes the data based on type
|
|
485
|
+
# @param string type Data type
|
|
486
|
+
# @param string value Value to be deserialized
|
|
487
|
+
# @return [Object] Deserialized data
|
|
488
|
+
def self._deserialize(type, value)
|
|
489
|
+
case type.to_sym
|
|
490
|
+
when :Time
|
|
491
|
+
Time.parse(value)
|
|
492
|
+
when :Date
|
|
493
|
+
Date.parse(value)
|
|
494
|
+
when :String
|
|
495
|
+
value.to_s
|
|
496
|
+
when :Integer
|
|
497
|
+
value.to_i
|
|
498
|
+
when :Float
|
|
499
|
+
value.to_f
|
|
500
|
+
when :Boolean
|
|
501
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
502
|
+
true
|
|
503
|
+
else
|
|
504
|
+
false
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
when :Object
|
|
508
|
+
# generic object (usually a Hash), return directly
|
|
509
|
+
value
|
|
510
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
511
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
512
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
513
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
514
|
+
k_type = Regexp.last_match[:k_type]
|
|
515
|
+
v_type = Regexp.last_match[:v_type]
|
|
516
|
+
{}.tap do |hash|
|
|
517
|
+
value.each do |k, v|
|
|
518
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
519
|
+
end
|
|
520
|
+
end
|
|
521
|
+
# model
|
|
522
|
+
else
|
|
523
|
+
# models (e.g. Pet) or oneOf
|
|
524
|
+
klass = Algolia::Search.const_get(type)
|
|
525
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
526
|
+
.build_from_hash(value)
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
# Returns the string representation of the object
|
|
531
|
+
# @return [String] String presentation of the object
|
|
532
|
+
def to_s
|
|
533
|
+
to_hash.to_s
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
537
|
+
# @return [Hash] Returns the object in the form of hash
|
|
538
|
+
def to_body
|
|
539
|
+
to_hash
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
def to_json(*_args)
|
|
543
|
+
to_hash.to_json
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
# Returns the object in the form of hash
|
|
547
|
+
# @return [Hash] Returns the object in the form of hash
|
|
548
|
+
def to_hash
|
|
549
|
+
hash = {}
|
|
550
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
551
|
+
value = send(attr)
|
|
552
|
+
if value.nil?
|
|
553
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
554
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
555
|
+
end
|
|
556
|
+
|
|
557
|
+
hash[param] = _to_hash(value)
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# also add attributes from additional_properties to hash
|
|
561
|
+
self.additional_properties&.each_pair do |k, v|
|
|
562
|
+
hash[k.to_sym] = _to_hash(v)
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
hash
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
# Outputs non-array value in the form of hash
|
|
569
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
570
|
+
# @param [Object] value Any valid value
|
|
571
|
+
# @return [Hash] Returns the value in the form of hash
|
|
572
|
+
def _to_hash(value)
|
|
573
|
+
if value.is_a?(Array)
|
|
574
|
+
value.compact.map { |v| _to_hash(v) }
|
|
575
|
+
elsif value.is_a?(Hash)
|
|
576
|
+
{}.tap do |hash|
|
|
577
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
578
|
+
end
|
|
579
|
+
elsif value.respond_to?(:to_hash)
|
|
580
|
+
value.to_hash
|
|
581
|
+
else
|
|
582
|
+
value
|
|
583
|
+
end
|
|
584
|
+
end
|
|
585
|
+
end
|
|
586
|
+
end
|
|
587
|
+
end
|
data/lib/algolia/version.rb
CHANGED
data/lib/algolia.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# 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.
|
|
4
|
-
|
|
5
3
|
# Common files
|
|
6
4
|
require "algolia/api_client"
|
|
7
5
|
require "algolia/api_error"
|
|
6
|
+
require "algolia/chunked_helper_options"
|
|
8
7
|
require "algolia/defaults"
|
|
9
8
|
require "algolia/error"
|
|
10
9
|
require "algolia/version"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: algolia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.40.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- https://alg.li/support
|
|
@@ -143,6 +143,7 @@ files:
|
|
|
143
143
|
- lib/algolia/api/search_client.rb
|
|
144
144
|
- lib/algolia/api_client.rb
|
|
145
145
|
- lib/algolia/api_error.rb
|
|
146
|
+
- lib/algolia/chunked_helper_options.rb
|
|
146
147
|
- lib/algolia/configuration.rb
|
|
147
148
|
- lib/algolia/defaults.rb
|
|
148
149
|
- lib/algolia/error.rb
|
|
@@ -744,6 +745,9 @@ files:
|
|
|
744
745
|
- lib/algolia/models/search/facet_stats.rb
|
|
745
746
|
- lib/algolia/models/search/facets.rb
|
|
746
747
|
- lib/algolia/models/search/fetched_index.rb
|
|
748
|
+
- lib/algolia/models/search/fetched_index_ab_test.rb
|
|
749
|
+
- lib/algolia/models/search/fetched_index_ab_test_target.rb
|
|
750
|
+
- lib/algolia/models/search/fetched_index_ab_test_variant.rb
|
|
747
751
|
- lib/algolia/models/search/get_api_key_response.rb
|
|
748
752
|
- lib/algolia/models/search/get_dictionary_settings_response.rb
|
|
749
753
|
- lib/algolia/models/search/get_logs_response.rb
|
|
@@ -818,6 +822,7 @@ files:
|
|
|
818
822
|
- lib/algolia/models/search/search_params_string.rb
|
|
819
823
|
- lib/algolia/models/search/search_query.rb
|
|
820
824
|
- lib/algolia/models/search/search_response.rb
|
|
825
|
+
- lib/algolia/models/search/search_response_partial.rb
|
|
821
826
|
- lib/algolia/models/search/search_responses.rb
|
|
822
827
|
- lib/algolia/models/search/search_result.rb
|
|
823
828
|
- lib/algolia/models/search/search_rules_params.rb
|
|
@@ -886,7 +891,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
886
891
|
- !ruby/object:Gem::Version
|
|
887
892
|
version: '0'
|
|
888
893
|
requirements: []
|
|
889
|
-
rubygems_version: 4.0.
|
|
894
|
+
rubygems_version: 4.0.10
|
|
890
895
|
specification_version: 4
|
|
891
896
|
summary: A simple Ruby client for the algolia.com REST API
|
|
892
897
|
test_files: []
|