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

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 (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,616 +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 Search
8
- class BaseSearchParamsWithoutQuery
9
- # 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.
10
- attr_accessor :similar_query
11
-
12
- # 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/).
13
- attr_accessor :filters
14
-
15
- attr_accessor :facet_filters
16
-
17
- attr_accessor :optional_filters
18
-
19
- attr_accessor :numeric_filters
20
-
21
- attr_accessor :tag_filters
22
-
23
- # 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).
24
- attr_accessor :sum_or_filters_scores
25
-
26
- # Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive.
27
- attr_accessor :restrict_searchable_attributes
28
-
29
- # 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).
30
- attr_accessor :facets
31
-
32
- # 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`.
33
- attr_accessor :faceting_after_distinct
34
-
35
- # Page of search results to retrieve.
36
- attr_accessor :page
37
-
38
- # Position of the first hit to retrieve.
39
- attr_accessor :offset
40
-
41
- # Number of hits to retrieve (used in combination with `offset`).
42
- attr_accessor :length
43
-
44
- # 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`.
45
- attr_accessor :around_lat_lng
46
-
47
- # Whether to obtain the coordinates from the request's IP address.
48
- attr_accessor :around_lat_lng_via_ip
49
-
50
- attr_accessor :around_radius
51
-
52
- attr_accessor :around_precision
53
-
54
- # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
55
- attr_accessor :minimum_around_radius
56
-
57
- # 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).
58
- attr_accessor :inside_bounding_box
59
-
60
- # 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`.
61
- attr_accessor :inside_polygon
62
-
63
- # 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`.
64
- attr_accessor :natural_languages
65
-
66
- # 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.
67
- attr_accessor :rule_contexts
68
-
69
- # 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).
70
- attr_accessor :personalization_impact
71
-
72
- # 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/).
73
- attr_accessor :user_token
74
-
75
- # Whether the search response should include detailed ranking information.
76
- attr_accessor :get_ranking_info
77
-
78
- # Whether to take into account an index's synonyms for this search.
79
- attr_accessor :synonyms
80
-
81
- # 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/).
82
- attr_accessor :click_analytics
83
-
84
- # Whether this search will be included in Analytics.
85
- attr_accessor :analytics
86
-
87
- # Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
88
- attr_accessor :analytics_tags
89
-
90
- # Whether to include this search when calculating processing-time percentiles.
91
- attr_accessor :percentile_computation
92
-
93
- # Whether to enable A/B testing for this search.
94
- attr_accessor :enable_ab_test
95
-
96
- # Attribute mapping from ruby-style variable name to JSON key.
97
- def self.attribute_map
98
- {
99
- :similar_query => :similarQuery,
100
- :filters => :filters,
101
- :facet_filters => :facetFilters,
102
- :optional_filters => :optionalFilters,
103
- :numeric_filters => :numericFilters,
104
- :tag_filters => :tagFilters,
105
- :sum_or_filters_scores => :sumOrFiltersScores,
106
- :restrict_searchable_attributes => :restrictSearchableAttributes,
107
- :facets => :facets,
108
- :faceting_after_distinct => :facetingAfterDistinct,
109
- :page => :page,
110
- :offset => :offset,
111
- :length => :length,
112
- :around_lat_lng => :aroundLatLng,
113
- :around_lat_lng_via_ip => :aroundLatLngViaIP,
114
- :around_radius => :aroundRadius,
115
- :around_precision => :aroundPrecision,
116
- :minimum_around_radius => :minimumAroundRadius,
117
- :inside_bounding_box => :insideBoundingBox,
118
- :inside_polygon => :insidePolygon,
119
- :natural_languages => :naturalLanguages,
120
- :rule_contexts => :ruleContexts,
121
- :personalization_impact => :personalizationImpact,
122
- :user_token => :userToken,
123
- :get_ranking_info => :getRankingInfo,
124
- :synonyms => :synonyms,
125
- :click_analytics => :clickAnalytics,
126
- :analytics => :analytics,
127
- :analytics_tags => :analyticsTags,
128
- :percentile_computation => :percentileComputation,
129
- :enable_ab_test => :enableABTest
130
- }
131
- end
132
-
133
- # Returns all the JSON keys this model knows about
134
- def self.acceptable_attributes
135
- attribute_map.values
136
- end
137
-
138
- # Attribute type mapping.
139
- def self.types_mapping
140
- {
141
- :similar_query => :"String",
142
- :filters => :"String",
143
- :facet_filters => :"FacetFilters",
144
- :optional_filters => :"OptionalFilters",
145
- :numeric_filters => :"NumericFilters",
146
- :tag_filters => :"TagFilters",
147
- :sum_or_filters_scores => :"Boolean",
148
- :restrict_searchable_attributes => :"Array<String>",
149
- :facets => :"Array<String>",
150
- :faceting_after_distinct => :"Boolean",
151
- :page => :"Integer",
152
- :offset => :"Integer",
153
- :length => :"Integer",
154
- :around_lat_lng => :"String",
155
- :around_lat_lng_via_ip => :"Boolean",
156
- :around_radius => :"AroundRadius",
157
- :around_precision => :"AroundPrecision",
158
- :minimum_around_radius => :"Integer",
159
- :inside_bounding_box => :"Array<Array<Float>>",
160
- :inside_polygon => :"Array<Array<Float>>",
161
- :natural_languages => :"Array<SupportedLanguage>",
162
- :rule_contexts => :"Array<String>",
163
- :personalization_impact => :"Integer",
164
- :user_token => :"String",
165
- :get_ranking_info => :"Boolean",
166
- :synonyms => :"Boolean",
167
- :click_analytics => :"Boolean",
168
- :analytics => :"Boolean",
169
- :analytics_tags => :"Array<String>",
170
- :percentile_computation => :"Boolean",
171
- :enable_ab_test => :"Boolean"
172
- }
173
- end
174
-
175
- # List of attributes with nullable: true
176
- def self.openapi_nullable
177
- Set.new(
178
- []
179
- )
180
- end
181
-
182
- # Initializes the object
183
- # @param [Hash] attributes Model attributes in the form of hash
184
- def initialize(attributes = {})
185
- if (!attributes.is_a?(Hash))
186
- raise(
187
- ArgumentError,
188
- "The input argument (attributes) must be a hash in `Algolia::BaseSearchParamsWithoutQuery` initialize method"
189
- )
190
- end
191
-
192
- # check to see if the attribute exists and convert string to symbol for hash key
193
- attributes = attributes.each_with_object({}) { |(k, v), h|
194
- if (!self.class.attribute_map.key?(k.to_sym))
195
- raise(
196
- ArgumentError,
197
- "`#{k}` is not a valid attribute in `Algolia::BaseSearchParamsWithoutQuery`. Please check the name to make sure it's valid. List of attributes: " +
198
- self.class.attribute_map.keys.inspect
199
- )
200
- end
201
-
202
- h[k.to_sym] = v
203
- }
204
-
205
- if attributes.key?(:similar_query)
206
- self.similar_query = attributes[:similar_query]
207
- end
208
-
209
- if attributes.key?(:filters)
210
- self.filters = attributes[:filters]
211
- end
212
-
213
- if attributes.key?(:facet_filters)
214
- self.facet_filters = attributes[:facet_filters]
215
- end
216
-
217
- if attributes.key?(:optional_filters)
218
- self.optional_filters = attributes[:optional_filters]
219
- end
220
-
221
- if attributes.key?(:numeric_filters)
222
- self.numeric_filters = attributes[:numeric_filters]
223
- end
224
-
225
- if attributes.key?(:tag_filters)
226
- self.tag_filters = attributes[:tag_filters]
227
- end
228
-
229
- if attributes.key?(:sum_or_filters_scores)
230
- self.sum_or_filters_scores = attributes[:sum_or_filters_scores]
231
- end
232
-
233
- if attributes.key?(:restrict_searchable_attributes)
234
- if (value = attributes[:restrict_searchable_attributes]).is_a?(Array)
235
- self.restrict_searchable_attributes = value
236
- end
237
- end
238
-
239
- if attributes.key?(:facets)
240
- if (value = attributes[:facets]).is_a?(Array)
241
- self.facets = value
242
- end
243
- end
244
-
245
- if attributes.key?(:faceting_after_distinct)
246
- self.faceting_after_distinct = attributes[:faceting_after_distinct]
247
- end
248
-
249
- if attributes.key?(:page)
250
- self.page = attributes[:page]
251
- end
252
-
253
- if attributes.key?(:offset)
254
- self.offset = attributes[:offset]
255
- end
256
-
257
- if attributes.key?(:length)
258
- self.length = attributes[:length]
259
- end
260
-
261
- if attributes.key?(:around_lat_lng)
262
- self.around_lat_lng = attributes[:around_lat_lng]
263
- end
264
-
265
- if attributes.key?(:around_lat_lng_via_ip)
266
- self.around_lat_lng_via_ip = attributes[:around_lat_lng_via_ip]
267
- end
268
-
269
- if attributes.key?(:around_radius)
270
- self.around_radius = attributes[:around_radius]
271
- end
272
-
273
- if attributes.key?(:around_precision)
274
- self.around_precision = attributes[:around_precision]
275
- end
276
-
277
- if attributes.key?(:minimum_around_radius)
278
- self.minimum_around_radius = attributes[:minimum_around_radius]
279
- end
280
-
281
- if attributes.key?(:inside_bounding_box)
282
- if (value = attributes[:inside_bounding_box]).is_a?(Array)
283
- self.inside_bounding_box = value
284
- end
285
- end
286
-
287
- if attributes.key?(:inside_polygon)
288
- if (value = attributes[:inside_polygon]).is_a?(Array)
289
- self.inside_polygon = value
290
- end
291
- end
292
-
293
- if attributes.key?(:natural_languages)
294
- if (value = attributes[:natural_languages]).is_a?(Array)
295
- self.natural_languages = value
296
- end
297
- end
298
-
299
- if attributes.key?(:rule_contexts)
300
- if (value = attributes[:rule_contexts]).is_a?(Array)
301
- self.rule_contexts = value
302
- end
303
- end
304
-
305
- if attributes.key?(:personalization_impact)
306
- self.personalization_impact = attributes[:personalization_impact]
307
- end
308
-
309
- if attributes.key?(:user_token)
310
- self.user_token = attributes[:user_token]
311
- end
312
-
313
- if attributes.key?(:get_ranking_info)
314
- self.get_ranking_info = attributes[:get_ranking_info]
315
- end
316
-
317
- if attributes.key?(:synonyms)
318
- self.synonyms = attributes[:synonyms]
319
- end
320
-
321
- if attributes.key?(:click_analytics)
322
- self.click_analytics = attributes[:click_analytics]
323
- end
324
-
325
- if attributes.key?(:analytics)
326
- self.analytics = attributes[:analytics]
327
- end
328
-
329
- if attributes.key?(:analytics_tags)
330
- if (value = attributes[:analytics_tags]).is_a?(Array)
331
- self.analytics_tags = value
332
- end
333
- end
334
-
335
- if attributes.key?(:percentile_computation)
336
- self.percentile_computation = attributes[:percentile_computation]
337
- end
338
-
339
- if attributes.key?(:enable_ab_test)
340
- self.enable_ab_test = attributes[:enable_ab_test]
341
- end
342
- end
343
-
344
- # Custom attribute writer method with validation
345
- # @param [Object] page Value to be assigned
346
- def page=(page)
347
- if page.nil?
348
- raise ArgumentError, "page cannot be nil"
349
- end
350
-
351
- if page < 0
352
- raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0."
353
- end
354
-
355
- @page = page
356
- end
357
-
358
- # Custom attribute writer method with validation
359
- # @param [Object] length Value to be assigned
360
- def length=(length)
361
- if length.nil?
362
- raise ArgumentError, "length cannot be nil"
363
- end
364
-
365
- if length > 1000
366
- raise ArgumentError, "invalid value for \"length\", must be smaller than or equal to 1000."
367
- end
368
-
369
- if length < 1
370
- raise ArgumentError, "invalid value for \"length\", must be greater than or equal to 1."
371
- end
372
-
373
- @length = length
374
- end
375
-
376
- # Custom attribute writer method with validation
377
- # @param [Object] minimum_around_radius Value to be assigned
378
- def minimum_around_radius=(minimum_around_radius)
379
- if minimum_around_radius.nil?
380
- raise ArgumentError, "minimum_around_radius cannot be nil"
381
- end
382
-
383
- if minimum_around_radius < 1
384
- raise ArgumentError, "invalid value for \"minimum_around_radius\", must be greater than or equal to 1."
385
- end
386
-
387
- @minimum_around_radius = minimum_around_radius
388
- end
389
-
390
- # Custom attribute writer method with validation
391
- # @param [Object] personalization_impact Value to be assigned
392
- def personalization_impact=(personalization_impact)
393
- if personalization_impact.nil?
394
- raise ArgumentError, "personalization_impact cannot be nil"
395
- end
396
-
397
- if personalization_impact > 100
398
- raise ArgumentError, "invalid value for \"personalization_impact\", must be smaller than or equal to 100."
399
- end
400
-
401
- if personalization_impact < 0
402
- raise ArgumentError, "invalid value for \"personalization_impact\", must be greater than or equal to 0."
403
- end
404
-
405
- @personalization_impact = personalization_impact
406
- end
407
-
408
- # Checks equality by comparing each attribute.
409
- # @param [Object] Object to be compared
410
- def ==(other)
411
- return true if self.equal?(other)
412
- self.class == other.class &&
413
- similar_query == other.similar_query &&
414
- filters == other.filters &&
415
- facet_filters == other.facet_filters &&
416
- optional_filters == other.optional_filters &&
417
- numeric_filters == other.numeric_filters &&
418
- tag_filters == other.tag_filters &&
419
- sum_or_filters_scores == other.sum_or_filters_scores &&
420
- restrict_searchable_attributes == other.restrict_searchable_attributes &&
421
- facets == other.facets &&
422
- faceting_after_distinct == other.faceting_after_distinct &&
423
- page == other.page &&
424
- offset == other.offset &&
425
- length == other.length &&
426
- around_lat_lng == other.around_lat_lng &&
427
- around_lat_lng_via_ip == other.around_lat_lng_via_ip &&
428
- around_radius == other.around_radius &&
429
- around_precision == other.around_precision &&
430
- minimum_around_radius == other.minimum_around_radius &&
431
- inside_bounding_box == other.inside_bounding_box &&
432
- inside_polygon == other.inside_polygon &&
433
- natural_languages == other.natural_languages &&
434
- rule_contexts == other.rule_contexts &&
435
- personalization_impact == other.personalization_impact &&
436
- user_token == other.user_token &&
437
- get_ranking_info == other.get_ranking_info &&
438
- synonyms == other.synonyms &&
439
- click_analytics == other.click_analytics &&
440
- analytics == other.analytics &&
441
- analytics_tags == other.analytics_tags &&
442
- percentile_computation == other.percentile_computation &&
443
- enable_ab_test == other.enable_ab_test
444
- end
445
-
446
- # @see the `==` method
447
- # @param [Object] Object to be compared
448
- def eql?(other)
449
- self == other
450
- end
451
-
452
- # Calculates hash code according to all attributes.
453
- # @return [Integer] Hash code
454
- def hash
455
- [
456
- similar_query,
457
- filters,
458
- facet_filters,
459
- optional_filters,
460
- numeric_filters,
461
- tag_filters,
462
- sum_or_filters_scores,
463
- restrict_searchable_attributes,
464
- facets,
465
- faceting_after_distinct,
466
- page,
467
- offset,
468
- length,
469
- around_lat_lng,
470
- around_lat_lng_via_ip,
471
- around_radius,
472
- around_precision,
473
- minimum_around_radius,
474
- inside_bounding_box,
475
- inside_polygon,
476
- natural_languages,
477
- rule_contexts,
478
- personalization_impact,
479
- user_token,
480
- get_ranking_info,
481
- synonyms,
482
- click_analytics,
483
- analytics,
484
- analytics_tags,
485
- percentile_computation,
486
- enable_ab_test
487
- ].hash
488
- end
489
-
490
- # Builds the object from hash
491
- # @param [Hash] attributes Model attributes in the form of hash
492
- # @return [Object] Returns the model itself
493
- def self.build_from_hash(attributes)
494
- return nil unless attributes.is_a?(Hash)
495
- attributes = attributes.transform_keys(&:to_sym)
496
- transformed_hash = {}
497
- types_mapping.each_pair do |key, type|
498
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
499
- transformed_hash[key.to_sym] = nil
500
- elsif type =~ /\AArray<(.*)>/i
501
- # check to ensure the input is an array given that the attribute
502
- # is documented as an array but the input is not
503
- if attributes[attribute_map[key]].is_a?(Array)
504
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
505
- _deserialize(::Regexp.last_match(1), v)
506
- }
507
- end
508
- elsif !attributes[attribute_map[key]].nil?
509
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
510
- end
511
- end
512
-
513
- new(transformed_hash)
514
- end
515
-
516
- # Deserializes the data based on type
517
- # @param string type Data type
518
- # @param string value Value to be deserialized
519
- # @return [Object] Deserialized data
520
- def self._deserialize(type, value)
521
- case type.to_sym
522
- when :Time
523
- Time.parse(value)
524
- when :Date
525
- Date.parse(value)
526
- when :String
527
- value.to_s
528
- when :Integer
529
- value.to_i
530
- when :Float
531
- value.to_f
532
- when :Boolean
533
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
534
- true
535
- else
536
- false
537
- end
538
-
539
- when :Object
540
- # generic object (usually a Hash), return directly
541
- value
542
- when /\AArray<(?<inner_type>.+)>\z/
543
- inner_type = Regexp.last_match[:inner_type]
544
- value.map { |v| _deserialize(inner_type, v) }
545
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
546
- k_type = Regexp.last_match[:k_type]
547
- v_type = Regexp.last_match[:v_type]
548
- {}.tap do |hash|
549
- value.each do |k, v|
550
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
551
- end
552
- end
553
- # model
554
- else
555
- # models (e.g. Pet) or oneOf
556
- klass = Algolia::Search.const_get(type)
557
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
558
- .build_from_hash(value)
559
- end
560
- end
561
-
562
- # Returns the string representation of the object
563
- # @return [String] String presentation of the object
564
- def to_s
565
- to_hash.to_s
566
- end
567
-
568
- # to_body is an alias to to_hash (backward compatibility)
569
- # @return [Hash] Returns the object in the form of hash
570
- def to_body
571
- to_hash
572
- end
573
-
574
- def to_json(*_args)
575
- to_hash.to_json
576
- end
577
-
578
- # Returns the object in the form of hash
579
- # @return [Hash] Returns the object in the form of hash
580
- def to_hash
581
- hash = {}
582
- self.class.attribute_map.each_pair do |attr, param|
583
- value = send(attr)
584
- if value.nil?
585
- is_nullable = self.class.openapi_nullable.include?(attr)
586
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
587
- end
588
-
589
- hash[param] = _to_hash(value)
590
- end
591
-
592
- hash
593
- end
594
-
595
- # Outputs non-array value in the form of hash
596
- # For object, use to_hash. Otherwise, just return the value
597
- # @param [Object] value Any valid value
598
- # @return [Hash] Returns the value in the form of hash
599
- def _to_hash(value)
600
- if value.is_a?(Array)
601
- value.compact.map { |v| _to_hash(v) }
602
- elsif value.is_a?(Hash)
603
- {}.tap do |hash|
604
- value.each { |k, v| hash[k] = _to_hash(v) }
605
- end
606
- elsif value.respond_to?(:to_hash)
607
- value.to_hash
608
- else
609
- value
610
- end
611
- end
612
-
613
- end
614
-
615
- end
616
- end