algolia 3.0.0.beta.11 → 3.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile.lock +2 -2
  4. data/lib/algolia/api/query_suggestions_client.rb +4 -10
  5. data/lib/algolia/api/search_client.rb +2 -2
  6. data/lib/algolia/api/usage_client.rb +4 -4
  7. data/lib/algolia/models/abtesting/{filter_effects_empty_search.rb → empty_search_filter.rb} +3 -3
  8. data/lib/algolia/models/abtesting/filter_effects.rb +2 -2
  9. data/lib/algolia/models/abtesting/{filter_effects_outliers.rb → outliers_filter.rb} +3 -3
  10. data/lib/algolia/models/analytics/{click_positions_inner.rb → click_position.rb} +3 -3
  11. data/lib/algolia/models/analytics/get_click_positions_response.rb +1 -1
  12. data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
  13. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +1 -1
  14. data/lib/algolia/models/ingestion/docker_streams_input.rb +1 -0
  15. data/lib/algolia/models/ingestion/{transformation_try_response_error.rb → transformation_error.rb} +3 -3
  16. data/lib/algolia/models/ingestion/transformation_try_response.rb +1 -1
  17. data/lib/algolia/models/monitoring/{incidents_inner.rb → incident_entry.rb} +3 -3
  18. data/lib/algolia/models/monitoring/{indexing_time_response_metrics.rb → indexing_metric.rb} +3 -3
  19. data/lib/algolia/models/monitoring/indexing_time_response.rb +1 -1
  20. data/lib/algolia/models/monitoring/infrastructure_response.rb +1 -1
  21. data/lib/algolia/models/monitoring/{latency_response_metrics.rb → latency_metric.rb} +3 -3
  22. data/lib/algolia/models/monitoring/latency_response.rb +1 -1
  23. data/lib/algolia/models/monitoring/{infrastructure_response_metrics.rb → metrics.rb} +3 -6
  24. data/lib/algolia/models/monitoring/{time_inner.rb → time_entry.rb} +3 -3
  25. data/lib/algolia/models/{search/search_for_hits_options.rb → query-suggestions/config_status.rb} +43 -36
  26. data/lib/algolia/models/{recommend/related_products.rb → query-suggestions/log_file.rb} +36 -32
  27. data/lib/algolia/models/recommend/around_precision.rb +1 -1
  28. data/lib/algolia/models/recommend/fallback_params.rb +1 -1
  29. data/lib/algolia/models/recommend/{around_precision_from_value_inner.rb → range.rb} +3 -6
  30. data/lib/algolia/models/recommend/recommend_rule.rb +1 -1
  31. data/lib/algolia/models/recommend/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  32. data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +1 -1
  33. data/lib/algolia/models/recommend/{recommend_rule_metadata.rb → rule_metadata.rb} +3 -3
  34. data/lib/algolia/models/recommend/search_params.rb +1 -1
  35. data/lib/algolia/models/recommend/search_params_object.rb +1 -1
  36. data/lib/algolia/models/search/around_precision.rb +1 -1
  37. data/lib/algolia/models/search/browse_params_object.rb +1 -1
  38. data/lib/algolia/models/search/built_in_operation.rb +1 -2
  39. data/lib/algolia/models/search/built_in_operation_value.rb +105 -0
  40. data/lib/algolia/models/search/consequence_params.rb +1 -1
  41. data/lib/algolia/models/search/dictionary_entry.rb +0 -2
  42. data/lib/algolia/models/search/index_settings.rb +2 -2
  43. data/lib/algolia/models/search/{around_precision_from_value_inner.rb → range.rb} +3 -6
  44. data/lib/algolia/models/search/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  45. data/lib/algolia/models/search/redirect_rule_index_metadata.rb +1 -1
  46. data/lib/algolia/models/search/search_for_facets.rb +1 -1
  47. data/lib/algolia/models/search/search_for_hits.rb +1 -1
  48. data/lib/algolia/models/search/search_params_object.rb +1 -1
  49. data/lib/algolia/models/search/search_params_string.rb +1 -0
  50. data/lib/algolia/models/search/settings_response.rb +2 -2
  51. data/lib/algolia/models/usage/{get_usage400_response_error_errors_inner.rb → error_item.rb} +3 -3
  52. data/lib/algolia/models/usage/{get_usage400_response_error.rb → forbidden_error.rb} +4 -4
  53. data/lib/algolia/models/usage/{get_usage200_response.rb → index_usage.rb} +4 -4
  54. data/lib/algolia/models/usage/invalid_request_error.rb +231 -0
  55. data/lib/algolia/models/usage/{get_usage200_response_statistics_inner.rb → statistic_entry.rb} +3 -3
  56. data/lib/algolia/version.rb +1 -1
  57. metadata +24 -64
  58. data/lib/algolia/models/abtesting/custom_search_params.rb +0 -214
  59. data/lib/algolia/models/abtesting/error_base.rb +0 -212
  60. data/lib/algolia/models/analytics/error_base.rb +0 -212
  61. data/lib/algolia/models/ingestion/error_base.rb +0 -212
  62. data/lib/algolia/models/ingestion/source_shopify_base.rb +0 -214
  63. data/lib/algolia/models/insights/error_base.rb +0 -212
  64. data/lib/algolia/models/monitoring/error_base.rb +0 -212
  65. data/lib/algolia/models/monitoring/get_servers403_response.rb +0 -211
  66. data/lib/algolia/models/personalization/error_base.rb +0 -212
  67. data/lib/algolia/models/query-suggestions/app_id.rb +0 -209
  68. data/lib/algolia/models/query-suggestions/error_base.rb +0 -212
  69. data/lib/algolia/models/recommend/base_recommend_request.rb +0 -281
  70. data/lib/algolia/models/recommend/base_search_params.rb +0 -635
  71. data/lib/algolia/models/recommend/base_search_params_without_query.rb +0 -616
  72. data/lib/algolia/models/recommend/base_search_response.rb +0 -499
  73. data/lib/algolia/models/recommend/error_base.rb +0 -212
  74. data/lib/algolia/models/recommend/frequently_bought_together.rb +0 -247
  75. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +0 -788
  76. data/lib/algolia/models/recommend/looking_similar.rb +0 -256
  77. data/lib/algolia/models/recommend/recommendations_hits.rb +0 -215
  78. data/lib/algolia/models/recommend/recommended_for_you.rb +0 -244
  79. data/lib/algolia/models/recommend/search_pagination.rb +0 -282
  80. data/lib/algolia/models/recommend/search_params_query.rb +0 -212
  81. data/lib/algolia/models/recommend/trending_facets.rb +0 -258
  82. data/lib/algolia/models/recommend/trending_items.rb +0 -264
  83. data/lib/algolia/models/search/base_get_api_key_response.rb +0 -224
  84. data/lib/algolia/models/search/base_index_settings.rb +0 -426
  85. data/lib/algolia/models/search/base_search_params.rb +0 -635
  86. data/lib/algolia/models/search/base_search_params_without_query.rb +0 -616
  87. data/lib/algolia/models/search/base_search_response.rb +0 -499
  88. data/lib/algolia/models/search/browse_pagination.rb +0 -274
  89. data/lib/algolia/models/search/cursor.rb +0 -209
  90. data/lib/algolia/models/search/error_base.rb +0 -212
  91. data/lib/algolia/models/search/index_settings_as_search_params.rb +0 -788
  92. data/lib/algolia/models/search/params.rb +0 -236
  93. data/lib/algolia/models/search/search_for_facets_options.rb +0 -293
  94. data/lib/algolia/models/search/search_hits.rb +0 -240
  95. data/lib/algolia/models/search/search_pagination.rb +0 -282
  96. data/lib/algolia/models/search/search_params_query.rb +0 -212
  97. data/lib/algolia/models/search/with_primary.rb +0 -212
  98. data/lib/algolia/models/usage/error_base.rb +0 -212
  99. data/lib/algolia/models/usage/get_usage400_response.rb +0 -213
@@ -1,635 +0,0 @@
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 Recommend
8
- class BaseSearchParams
9
- # Search query.
10
- attr_accessor :query
11
-
12
- # Keywords to be used instead of the search query to conduct a more broader search. Using the `similarQuery` parameter changes other settings: - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords`. Since the `similarQuery` is supposed to do a broad search, they usually return many results. Combine it with `filters` to narrow down the list of results.
13
- attr_accessor :similar_query
14
-
15
- # Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/).
16
- attr_accessor :filters
17
-
18
- attr_accessor :facet_filters
19
-
20
- attr_accessor :optional_filters
21
-
22
- attr_accessor :numeric_filters
23
-
24
- attr_accessor :tag_filters
25
-
26
- # Whether to sum all filter scores. If true, all filter scores are summed. Otherwise, the maximum filter score is kept. For more information, see [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores).
27
- attr_accessor :sum_or_filters_scores
28
-
29
- # Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive.
30
- attr_accessor :restrict_searchable_attributes
31
-
32
- # Facets for which to retrieve facet values that match the search criteria and the number of matching facet values. To retrieve all facets, use the wildcard character `*`. For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts).
33
- attr_accessor :facets
34
-
35
- # Whether faceting should be applied after deduplication with `distinct`. This leads to accurate facet counts when using faceting in combination with `distinct`. It's usually better to use `afterDistinct` modifiers in the `attributesForFaceting` setting, as `facetingAfterDistinct` only computes correct facet counts if all records have the same facet values for the `attributeForDistinct`.
36
- attr_accessor :faceting_after_distinct
37
-
38
- # Page of search results to retrieve.
39
- attr_accessor :page
40
-
41
- # Position of the first hit to retrieve.
42
- attr_accessor :offset
43
-
44
- # Number of hits to retrieve (used in combination with `offset`).
45
- attr_accessor :length
46
-
47
- # Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`.
48
- attr_accessor :around_lat_lng
49
-
50
- # Whether to obtain the coordinates from the request's IP address.
51
- attr_accessor :around_lat_lng_via_ip
52
-
53
- attr_accessor :around_radius
54
-
55
- attr_accessor :around_precision
56
-
57
- # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
58
- attr_accessor :minimum_around_radius
59
-
60
- # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
61
- attr_accessor :inside_bounding_box
62
-
63
- # Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`.
64
- attr_accessor :inside_polygon
65
-
66
- # ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches): - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.
67
- attr_accessor :natural_languages
68
-
69
- # Assigns a rule context to the search query. [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules.
70
- attr_accessor :rule_contexts
71
-
72
- # Impact that Personalization should have on this search. The higher this value is, the more Personalization determines the ranking compared to other factors. For more information, see [Understanding Personalization impact](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).
73
- attr_accessor :personalization_impact
74
-
75
- # Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
76
- attr_accessor :user_token
77
-
78
- # Whether the search response should include detailed ranking information.
79
- attr_accessor :get_ranking_info
80
-
81
- # Whether to take into account an index's synonyms for this search.
82
- attr_accessor :synonyms
83
-
84
- # Whether to include a `queryID` attribute in the response. The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/guides/sending-events/getting-started/).
85
- attr_accessor :click_analytics
86
-
87
- # Whether this search will be included in Analytics.
88
- attr_accessor :analytics
89
-
90
- # Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
91
- attr_accessor :analytics_tags
92
-
93
- # Whether to include this search when calculating processing-time percentiles.
94
- attr_accessor :percentile_computation
95
-
96
- # Whether to enable A/B testing for this search.
97
- attr_accessor :enable_ab_test
98
-
99
- # Attribute mapping from ruby-style variable name to JSON key.
100
- def self.attribute_map
101
- {
102
- :query => :query,
103
- :similar_query => :similarQuery,
104
- :filters => :filters,
105
- :facet_filters => :facetFilters,
106
- :optional_filters => :optionalFilters,
107
- :numeric_filters => :numericFilters,
108
- :tag_filters => :tagFilters,
109
- :sum_or_filters_scores => :sumOrFiltersScores,
110
- :restrict_searchable_attributes => :restrictSearchableAttributes,
111
- :facets => :facets,
112
- :faceting_after_distinct => :facetingAfterDistinct,
113
- :page => :page,
114
- :offset => :offset,
115
- :length => :length,
116
- :around_lat_lng => :aroundLatLng,
117
- :around_lat_lng_via_ip => :aroundLatLngViaIP,
118
- :around_radius => :aroundRadius,
119
- :around_precision => :aroundPrecision,
120
- :minimum_around_radius => :minimumAroundRadius,
121
- :inside_bounding_box => :insideBoundingBox,
122
- :inside_polygon => :insidePolygon,
123
- :natural_languages => :naturalLanguages,
124
- :rule_contexts => :ruleContexts,
125
- :personalization_impact => :personalizationImpact,
126
- :user_token => :userToken,
127
- :get_ranking_info => :getRankingInfo,
128
- :synonyms => :synonyms,
129
- :click_analytics => :clickAnalytics,
130
- :analytics => :analytics,
131
- :analytics_tags => :analyticsTags,
132
- :percentile_computation => :percentileComputation,
133
- :enable_ab_test => :enableABTest
134
- }
135
- end
136
-
137
- # Returns all the JSON keys this model knows about
138
- def self.acceptable_attributes
139
- attribute_map.values
140
- end
141
-
142
- # Attribute type mapping.
143
- def self.types_mapping
144
- {
145
- :query => :"String",
146
- :similar_query => :"String",
147
- :filters => :"String",
148
- :facet_filters => :"FacetFilters",
149
- :optional_filters => :"OptionalFilters",
150
- :numeric_filters => :"NumericFilters",
151
- :tag_filters => :"TagFilters",
152
- :sum_or_filters_scores => :"Boolean",
153
- :restrict_searchable_attributes => :"Array<String>",
154
- :facets => :"Array<String>",
155
- :faceting_after_distinct => :"Boolean",
156
- :page => :"Integer",
157
- :offset => :"Integer",
158
- :length => :"Integer",
159
- :around_lat_lng => :"String",
160
- :around_lat_lng_via_ip => :"Boolean",
161
- :around_radius => :"AroundRadius",
162
- :around_precision => :"AroundPrecision",
163
- :minimum_around_radius => :"Integer",
164
- :inside_bounding_box => :"Array<Array<Float>>",
165
- :inside_polygon => :"Array<Array<Float>>",
166
- :natural_languages => :"Array<SupportedLanguage>",
167
- :rule_contexts => :"Array<String>",
168
- :personalization_impact => :"Integer",
169
- :user_token => :"String",
170
- :get_ranking_info => :"Boolean",
171
- :synonyms => :"Boolean",
172
- :click_analytics => :"Boolean",
173
- :analytics => :"Boolean",
174
- :analytics_tags => :"Array<String>",
175
- :percentile_computation => :"Boolean",
176
- :enable_ab_test => :"Boolean"
177
- }
178
- end
179
-
180
- # List of attributes with nullable: true
181
- def self.openapi_nullable
182
- Set.new(
183
- []
184
- )
185
- end
186
-
187
- # List of class defined in allOf (OpenAPI v3)
188
- def self.openapi_all_of
189
- [
190
- :"BaseSearchParamsWithoutQuery",
191
- :"SearchParamsQuery"
192
- ]
193
- end
194
-
195
- # Initializes the object
196
- # @param [Hash] attributes Model attributes in the form of hash
197
- def initialize(attributes = {})
198
- if (!attributes.is_a?(Hash))
199
- raise(
200
- ArgumentError,
201
- "The input argument (attributes) must be a hash in `Algolia::BaseSearchParams` initialize method"
202
- )
203
- end
204
-
205
- # check to see if the attribute exists and convert string to symbol for hash key
206
- attributes = attributes.each_with_object({}) { |(k, v), h|
207
- if (!self.class.attribute_map.key?(k.to_sym))
208
- raise(
209
- ArgumentError,
210
- "`#{k}` is not a valid attribute in `Algolia::BaseSearchParams`. Please check the name to make sure it's valid. List of attributes: " +
211
- self.class.attribute_map.keys.inspect
212
- )
213
- end
214
-
215
- h[k.to_sym] = v
216
- }
217
-
218
- if attributes.key?(:query)
219
- self.query = attributes[:query]
220
- end
221
-
222
- if attributes.key?(:similar_query)
223
- self.similar_query = attributes[:similar_query]
224
- end
225
-
226
- if attributes.key?(:filters)
227
- self.filters = attributes[:filters]
228
- end
229
-
230
- if attributes.key?(:facet_filters)
231
- self.facet_filters = attributes[:facet_filters]
232
- end
233
-
234
- if attributes.key?(:optional_filters)
235
- self.optional_filters = attributes[:optional_filters]
236
- end
237
-
238
- if attributes.key?(:numeric_filters)
239
- self.numeric_filters = attributes[:numeric_filters]
240
- end
241
-
242
- if attributes.key?(:tag_filters)
243
- self.tag_filters = attributes[:tag_filters]
244
- end
245
-
246
- if attributes.key?(:sum_or_filters_scores)
247
- self.sum_or_filters_scores = attributes[:sum_or_filters_scores]
248
- end
249
-
250
- if attributes.key?(:restrict_searchable_attributes)
251
- if (value = attributes[:restrict_searchable_attributes]).is_a?(Array)
252
- self.restrict_searchable_attributes = value
253
- end
254
- end
255
-
256
- if attributes.key?(:facets)
257
- if (value = attributes[:facets]).is_a?(Array)
258
- self.facets = value
259
- end
260
- end
261
-
262
- if attributes.key?(:faceting_after_distinct)
263
- self.faceting_after_distinct = attributes[:faceting_after_distinct]
264
- end
265
-
266
- if attributes.key?(:page)
267
- self.page = attributes[:page]
268
- end
269
-
270
- if attributes.key?(:offset)
271
- self.offset = attributes[:offset]
272
- end
273
-
274
- if attributes.key?(:length)
275
- self.length = attributes[:length]
276
- end
277
-
278
- if attributes.key?(:around_lat_lng)
279
- self.around_lat_lng = attributes[:around_lat_lng]
280
- end
281
-
282
- if attributes.key?(:around_lat_lng_via_ip)
283
- self.around_lat_lng_via_ip = attributes[:around_lat_lng_via_ip]
284
- end
285
-
286
- if attributes.key?(:around_radius)
287
- self.around_radius = attributes[:around_radius]
288
- end
289
-
290
- if attributes.key?(:around_precision)
291
- self.around_precision = attributes[:around_precision]
292
- end
293
-
294
- if attributes.key?(:minimum_around_radius)
295
- self.minimum_around_radius = attributes[:minimum_around_radius]
296
- end
297
-
298
- if attributes.key?(:inside_bounding_box)
299
- if (value = attributes[:inside_bounding_box]).is_a?(Array)
300
- self.inside_bounding_box = value
301
- end
302
- end
303
-
304
- if attributes.key?(:inside_polygon)
305
- if (value = attributes[:inside_polygon]).is_a?(Array)
306
- self.inside_polygon = value
307
- end
308
- end
309
-
310
- if attributes.key?(:natural_languages)
311
- if (value = attributes[:natural_languages]).is_a?(Array)
312
- self.natural_languages = value
313
- end
314
- end
315
-
316
- if attributes.key?(:rule_contexts)
317
- if (value = attributes[:rule_contexts]).is_a?(Array)
318
- self.rule_contexts = value
319
- end
320
- end
321
-
322
- if attributes.key?(:personalization_impact)
323
- self.personalization_impact = attributes[:personalization_impact]
324
- end
325
-
326
- if attributes.key?(:user_token)
327
- self.user_token = attributes[:user_token]
328
- end
329
-
330
- if attributes.key?(:get_ranking_info)
331
- self.get_ranking_info = attributes[:get_ranking_info]
332
- end
333
-
334
- if attributes.key?(:synonyms)
335
- self.synonyms = attributes[:synonyms]
336
- end
337
-
338
- if attributes.key?(:click_analytics)
339
- self.click_analytics = attributes[:click_analytics]
340
- end
341
-
342
- if attributes.key?(:analytics)
343
- self.analytics = attributes[:analytics]
344
- end
345
-
346
- if attributes.key?(:analytics_tags)
347
- if (value = attributes[:analytics_tags]).is_a?(Array)
348
- self.analytics_tags = value
349
- end
350
- end
351
-
352
- if attributes.key?(:percentile_computation)
353
- self.percentile_computation = attributes[:percentile_computation]
354
- end
355
-
356
- if attributes.key?(:enable_ab_test)
357
- self.enable_ab_test = attributes[:enable_ab_test]
358
- end
359
- end
360
-
361
- # Custom attribute writer method with validation
362
- # @param [Object] page Value to be assigned
363
- def page=(page)
364
- if page.nil?
365
- raise ArgumentError, "page cannot be nil"
366
- end
367
-
368
- if page < 0
369
- raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0."
370
- end
371
-
372
- @page = page
373
- end
374
-
375
- # Custom attribute writer method with validation
376
- # @param [Object] length Value to be assigned
377
- def length=(length)
378
- if length.nil?
379
- raise ArgumentError, "length cannot be nil"
380
- end
381
-
382
- if length > 1000
383
- raise ArgumentError, "invalid value for \"length\", must be smaller than or equal to 1000."
384
- end
385
-
386
- if length < 1
387
- raise ArgumentError, "invalid value for \"length\", must be greater than or equal to 1."
388
- end
389
-
390
- @length = length
391
- end
392
-
393
- # Custom attribute writer method with validation
394
- # @param [Object] minimum_around_radius Value to be assigned
395
- def minimum_around_radius=(minimum_around_radius)
396
- if minimum_around_radius.nil?
397
- raise ArgumentError, "minimum_around_radius cannot be nil"
398
- end
399
-
400
- if minimum_around_radius < 1
401
- raise ArgumentError, "invalid value for \"minimum_around_radius\", must be greater than or equal to 1."
402
- end
403
-
404
- @minimum_around_radius = minimum_around_radius
405
- end
406
-
407
- # Custom attribute writer method with validation
408
- # @param [Object] personalization_impact Value to be assigned
409
- def personalization_impact=(personalization_impact)
410
- if personalization_impact.nil?
411
- raise ArgumentError, "personalization_impact cannot be nil"
412
- end
413
-
414
- if personalization_impact > 100
415
- raise ArgumentError, "invalid value for \"personalization_impact\", must be smaller than or equal to 100."
416
- end
417
-
418
- if personalization_impact < 0
419
- raise ArgumentError, "invalid value for \"personalization_impact\", must be greater than or equal to 0."
420
- end
421
-
422
- @personalization_impact = personalization_impact
423
- end
424
-
425
- # Checks equality by comparing each attribute.
426
- # @param [Object] Object to be compared
427
- def ==(other)
428
- return true if self.equal?(other)
429
- self.class == other.class &&
430
- query == other.query &&
431
- similar_query == other.similar_query &&
432
- filters == other.filters &&
433
- facet_filters == other.facet_filters &&
434
- optional_filters == other.optional_filters &&
435
- numeric_filters == other.numeric_filters &&
436
- tag_filters == other.tag_filters &&
437
- sum_or_filters_scores == other.sum_or_filters_scores &&
438
- restrict_searchable_attributes == other.restrict_searchable_attributes &&
439
- facets == other.facets &&
440
- faceting_after_distinct == other.faceting_after_distinct &&
441
- page == other.page &&
442
- offset == other.offset &&
443
- length == other.length &&
444
- around_lat_lng == other.around_lat_lng &&
445
- around_lat_lng_via_ip == other.around_lat_lng_via_ip &&
446
- around_radius == other.around_radius &&
447
- around_precision == other.around_precision &&
448
- minimum_around_radius == other.minimum_around_radius &&
449
- inside_bounding_box == other.inside_bounding_box &&
450
- inside_polygon == other.inside_polygon &&
451
- natural_languages == other.natural_languages &&
452
- rule_contexts == other.rule_contexts &&
453
- personalization_impact == other.personalization_impact &&
454
- user_token == other.user_token &&
455
- get_ranking_info == other.get_ranking_info &&
456
- synonyms == other.synonyms &&
457
- click_analytics == other.click_analytics &&
458
- analytics == other.analytics &&
459
- analytics_tags == other.analytics_tags &&
460
- percentile_computation == other.percentile_computation &&
461
- enable_ab_test == other.enable_ab_test
462
- end
463
-
464
- # @see the `==` method
465
- # @param [Object] Object to be compared
466
- def eql?(other)
467
- self == other
468
- end
469
-
470
- # Calculates hash code according to all attributes.
471
- # @return [Integer] Hash code
472
- def hash
473
- [
474
- query,
475
- similar_query,
476
- filters,
477
- facet_filters,
478
- optional_filters,
479
- numeric_filters,
480
- tag_filters,
481
- sum_or_filters_scores,
482
- restrict_searchable_attributes,
483
- facets,
484
- faceting_after_distinct,
485
- page,
486
- offset,
487
- length,
488
- around_lat_lng,
489
- around_lat_lng_via_ip,
490
- around_radius,
491
- around_precision,
492
- minimum_around_radius,
493
- inside_bounding_box,
494
- inside_polygon,
495
- natural_languages,
496
- rule_contexts,
497
- personalization_impact,
498
- user_token,
499
- get_ranking_info,
500
- synonyms,
501
- click_analytics,
502
- analytics,
503
- analytics_tags,
504
- percentile_computation,
505
- enable_ab_test
506
- ].hash
507
- end
508
-
509
- # Builds the object from hash
510
- # @param [Hash] attributes Model attributes in the form of hash
511
- # @return [Object] Returns the model itself
512
- def self.build_from_hash(attributes)
513
- return nil unless attributes.is_a?(Hash)
514
- attributes = attributes.transform_keys(&:to_sym)
515
- transformed_hash = {}
516
- types_mapping.each_pair do |key, type|
517
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
518
- transformed_hash[key.to_sym] = nil
519
- elsif type =~ /\AArray<(.*)>/i
520
- # check to ensure the input is an array given that the attribute
521
- # is documented as an array but the input is not
522
- if attributes[attribute_map[key]].is_a?(Array)
523
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
524
- _deserialize(::Regexp.last_match(1), v)
525
- }
526
- end
527
- elsif !attributes[attribute_map[key]].nil?
528
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
529
- end
530
- end
531
-
532
- new(transformed_hash)
533
- end
534
-
535
- # Deserializes the data based on type
536
- # @param string type Data type
537
- # @param string value Value to be deserialized
538
- # @return [Object] Deserialized data
539
- def self._deserialize(type, value)
540
- case type.to_sym
541
- when :Time
542
- Time.parse(value)
543
- when :Date
544
- Date.parse(value)
545
- when :String
546
- value.to_s
547
- when :Integer
548
- value.to_i
549
- when :Float
550
- value.to_f
551
- when :Boolean
552
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
553
- true
554
- else
555
- false
556
- end
557
-
558
- when :Object
559
- # generic object (usually a Hash), return directly
560
- value
561
- when /\AArray<(?<inner_type>.+)>\z/
562
- inner_type = Regexp.last_match[:inner_type]
563
- value.map { |v| _deserialize(inner_type, v) }
564
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
565
- k_type = Regexp.last_match[:k_type]
566
- v_type = Regexp.last_match[:v_type]
567
- {}.tap do |hash|
568
- value.each do |k, v|
569
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
570
- end
571
- end
572
- # model
573
- else
574
- # models (e.g. Pet) or oneOf
575
- klass = Algolia::Recommend.const_get(type)
576
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
577
- .build_from_hash(value)
578
- end
579
- end
580
-
581
- # Returns the string representation of the object
582
- # @return [String] String presentation of the object
583
- def to_s
584
- to_hash.to_s
585
- end
586
-
587
- # to_body is an alias to to_hash (backward compatibility)
588
- # @return [Hash] Returns the object in the form of hash
589
- def to_body
590
- to_hash
591
- end
592
-
593
- def to_json(*_args)
594
- to_hash.to_json
595
- end
596
-
597
- # Returns the object in the form of hash
598
- # @return [Hash] Returns the object in the form of hash
599
- def to_hash
600
- hash = {}
601
- self.class.attribute_map.each_pair do |attr, param|
602
- value = send(attr)
603
- if value.nil?
604
- is_nullable = self.class.openapi_nullable.include?(attr)
605
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
606
- end
607
-
608
- hash[param] = _to_hash(value)
609
- end
610
-
611
- hash
612
- end
613
-
614
- # Outputs non-array value in the form of hash
615
- # For object, use to_hash. Otherwise, just return the value
616
- # @param [Object] value Any valid value
617
- # @return [Hash] Returns the value in the form of hash
618
- def _to_hash(value)
619
- if value.is_a?(Array)
620
- value.compact.map { |v| _to_hash(v) }
621
- elsif value.is_a?(Hash)
622
- {}.tap do |hash|
623
- value.each { |k, v| hash[k] = _to_hash(v) }
624
- end
625
- elsif value.respond_to?(:to_hash)
626
- value.to_hash
627
- else
628
- value
629
- end
630
- end
631
-
632
- end
633
-
634
- end
635
- end