algolia 3.0.0.beta.10 → 3.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/Gemfile.lock +2 -2
  4. data/lib/algolia/api/ingestion_client.rb +912 -359
  5. data/lib/algolia/api/query_suggestions_client.rb +4 -10
  6. data/lib/algolia/api/search_client.rb +4 -4
  7. data/lib/algolia/api/usage_client.rb +4 -4
  8. data/lib/algolia/error.rb +10 -0
  9. data/lib/algolia/logger_helper.rb +11 -2
  10. data/lib/algolia/models/abtesting/{filter_effects_empty_search.rb → empty_search_filter.rb} +3 -3
  11. data/lib/algolia/models/abtesting/filter_effects.rb +2 -2
  12. data/lib/algolia/models/abtesting/{filter_effects_outliers.rb → outliers_filter.rb} +3 -3
  13. data/lib/algolia/models/analytics/{click_positions_inner.rb → click_position.rb} +3 -3
  14. data/lib/algolia/models/analytics/get_click_positions_response.rb +1 -1
  15. data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
  16. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +1 -1
  17. data/lib/algolia/models/ingestion/action.rb +45 -0
  18. data/lib/algolia/models/{search/search_for_hits_options.rb → ingestion/batch_request.rb} +22 -20
  19. data/lib/algolia/models/ingestion/{source_shopify_base.rb → batch_write_params.rb} +14 -12
  20. data/lib/algolia/models/ingestion/docker_streams_input.rb +1 -0
  21. data/lib/algolia/models/{recommend/recommendations_hits.rb → ingestion/list_tasks_response_v1.rb} +26 -14
  22. data/lib/algolia/models/ingestion/task.rb +30 -9
  23. data/lib/algolia/models/ingestion/task_create.rb +11 -12
  24. data/lib/algolia/models/{search/search_for_facets_options.rb → ingestion/task_create_v1.rb} +86 -51
  25. data/lib/algolia/models/ingestion/task_update.rb +8 -7
  26. data/lib/algolia/models/{search/browse_pagination.rb → ingestion/task_update_v1.rb} +50 -55
  27. data/lib/algolia/models/{recommend/looking_similar.rb → ingestion/task_v1.rb} +147 -30
  28. data/lib/algolia/models/ingestion/{transformation_try_response_error.rb → transformation_error.rb} +3 -3
  29. data/lib/algolia/models/ingestion/transformation_try_response.rb +1 -1
  30. data/lib/algolia/models/monitoring/{incidents_inner.rb → incident_entry.rb} +3 -3
  31. data/lib/algolia/models/monitoring/{indexing_time_response_metrics.rb → indexing_metric.rb} +3 -3
  32. data/lib/algolia/models/monitoring/indexing_time_response.rb +1 -1
  33. data/lib/algolia/models/monitoring/infrastructure_response.rb +1 -1
  34. data/lib/algolia/models/monitoring/{latency_response_metrics.rb → latency_metric.rb} +3 -3
  35. data/lib/algolia/models/monitoring/latency_response.rb +1 -1
  36. data/lib/algolia/models/monitoring/{infrastructure_response_metrics.rb → metrics.rb} +3 -6
  37. data/lib/algolia/models/monitoring/{time_inner.rb → time_entry.rb} +3 -3
  38. data/lib/algolia/models/{recommend/trending_items.rb → query-suggestions/config_status.rb} +46 -58
  39. data/lib/algolia/models/{recommend/related_products.rb → query-suggestions/log_file.rb} +36 -32
  40. data/lib/algolia/models/recommend/around_precision.rb +1 -1
  41. data/lib/algolia/models/recommend/fallback_params.rb +1 -1
  42. data/lib/algolia/models/recommend/{around_precision_from_value_inner.rb → range.rb} +3 -6
  43. data/lib/algolia/models/recommend/recommend_rule.rb +1 -1
  44. data/lib/algolia/models/recommend/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  45. data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +1 -1
  46. data/lib/algolia/models/recommend/{recommend_rule_metadata.rb → rule_metadata.rb} +3 -3
  47. data/lib/algolia/models/recommend/search_params.rb +1 -1
  48. data/lib/algolia/models/recommend/search_params_object.rb +1 -1
  49. data/lib/algolia/models/search/around_precision.rb +1 -1
  50. data/lib/algolia/models/search/browse_params_object.rb +1 -1
  51. data/lib/algolia/models/search/built_in_operation.rb +1 -2
  52. data/lib/algolia/models/search/built_in_operation_value.rb +105 -0
  53. data/lib/algolia/models/search/consequence_params.rb +1 -1
  54. data/lib/algolia/models/search/dictionary_entry.rb +0 -2
  55. data/lib/algolia/models/search/index_settings.rb +2 -2
  56. data/lib/algolia/models/search/{around_precision_from_value_inner.rb → range.rb} +3 -6
  57. data/lib/algolia/models/search/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  58. data/lib/algolia/models/search/redirect_rule_index_metadata.rb +1 -1
  59. data/lib/algolia/models/search/search_for_facets.rb +1 -1
  60. data/lib/algolia/models/search/search_for_hits.rb +1 -1
  61. data/lib/algolia/models/search/search_params_object.rb +1 -1
  62. data/lib/algolia/models/search/search_params_string.rb +1 -0
  63. data/lib/algolia/models/search/{index_settings_as_search_params.rb → settings_response.rb} +251 -11
  64. data/lib/algolia/models/usage/{get_usage400_response_error_errors_inner.rb → error_item.rb} +3 -3
  65. data/lib/algolia/models/usage/{get_usage400_response_error.rb → forbidden_error.rb} +4 -4
  66. data/lib/algolia/models/usage/{get_usage200_response.rb → index_usage.rb} +4 -4
  67. data/lib/algolia/models/usage/invalid_request_error.rb +231 -0
  68. data/lib/algolia/models/usage/{get_usage200_response_statistics_inner.rb → statistic_entry.rb} +3 -3
  69. data/lib/algolia/transport/transport.rb +8 -2
  70. data/lib/algolia/version.rb +1 -1
  71. metadata +32 -63
  72. data/lib/algolia/models/abtesting/custom_search_params.rb +0 -214
  73. data/lib/algolia/models/abtesting/error_base.rb +0 -212
  74. data/lib/algolia/models/analytics/error_base.rb +0 -212
  75. data/lib/algolia/models/ingestion/error_base.rb +0 -212
  76. data/lib/algolia/models/insights/error_base.rb +0 -212
  77. data/lib/algolia/models/monitoring/error_base.rb +0 -212
  78. data/lib/algolia/models/monitoring/get_servers403_response.rb +0 -211
  79. data/lib/algolia/models/personalization/error_base.rb +0 -212
  80. data/lib/algolia/models/query-suggestions/app_id.rb +0 -209
  81. data/lib/algolia/models/query-suggestions/error_base.rb +0 -212
  82. data/lib/algolia/models/recommend/base_recommend_request.rb +0 -281
  83. data/lib/algolia/models/recommend/base_search_params.rb +0 -635
  84. data/lib/algolia/models/recommend/base_search_params_without_query.rb +0 -616
  85. data/lib/algolia/models/recommend/base_search_response.rb +0 -499
  86. data/lib/algolia/models/recommend/error_base.rb +0 -212
  87. data/lib/algolia/models/recommend/frequently_bought_together.rb +0 -247
  88. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +0 -788
  89. data/lib/algolia/models/recommend/recommended_for_you.rb +0 -244
  90. data/lib/algolia/models/recommend/search_pagination.rb +0 -282
  91. data/lib/algolia/models/recommend/search_params_query.rb +0 -212
  92. data/lib/algolia/models/recommend/trending_facets.rb +0 -258
  93. data/lib/algolia/models/search/base_get_api_key_response.rb +0 -224
  94. data/lib/algolia/models/search/base_index_settings.rb +0 -426
  95. data/lib/algolia/models/search/base_search_params.rb +0 -635
  96. data/lib/algolia/models/search/base_search_params_without_query.rb +0 -616
  97. data/lib/algolia/models/search/base_search_response.rb +0 -499
  98. data/lib/algolia/models/search/cursor.rb +0 -209
  99. data/lib/algolia/models/search/error_base.rb +0 -212
  100. data/lib/algolia/models/search/params.rb +0 -236
  101. data/lib/algolia/models/search/search_hits.rb +0 -240
  102. data/lib/algolia/models/search/search_pagination.rb +0 -282
  103. data/lib/algolia/models/search/search_params_query.rb +0 -212
  104. data/lib/algolia/models/usage/error_base.rb +0 -212
  105. data/lib/algolia/models/usage/get_usage400_response.rb +0 -213
@@ -1,426 +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 BaseIndexSettings
9
- # Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/). Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive. **Modifiers** - `filterOnly(\"ATTRIBUTE\")`. Allows using this attribute as a filter, but doesn't evalue the facet values. - `searchable(\"ATTRIBUTE\")`. Allows searching for facet values. - `afterDistinct(\"ATTRIBUTE\")`. Evaluates the facet count _after_ deduplication with `distinct`. This ensures accurate facet counts. You can apply this modifier to searchable facets: `afterDistinct(searchable(ATTRIBUTE))`.
10
- attr_accessor :attributes_for_faceting
11
-
12
- # Creates [replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/). Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you'll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index. **Modifier** - `virtual(\"REPLICA\")`. Create a virtual replica, Virtual replicas don't increase the number of records and are optimized for [Relevant sorting](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/relevant-sort/).
13
- attr_accessor :replicas
14
-
15
- # Maximum number of search results that can be obtained through pagination. Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can't be guaranteed.
16
- attr_accessor :pagination_limited_to
17
-
18
- # Attributes that can't be retrieved at query time. This can be useful if you want to use an attribute for ranking or to [restrict access](https://www.algolia.com/doc/guides/security/api-keys/how-to/user-restricted-access-to-data/), but don't want to include it in the search results. Attribute names are case-sensitive.
19
- attr_accessor :unretrievable_attributes
20
-
21
- # Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). This also turns off [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation/) for the specified words.
22
- attr_accessor :disable_typo_tolerance_on_words
23
-
24
- # Attributes, for which you want to support [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead). Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive.
25
- attr_accessor :attributes_to_transliterate
26
-
27
- # Attributes for which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. Attribute names are case-sensitive.
28
- attr_accessor :camel_case_attributes
29
-
30
- # Searchable attributes to which Algolia should apply [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding). Attribute names are case-sensitive. Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, \"firefighter\". With decompounding, the individual components are indexed separately. You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (`nl`), German (`de`), Finnish (`fi`), Danish (`da`), Swedish (`sv`), and Norwegian (`no`).
31
- attr_accessor :decompounded_attributes
32
-
33
- # Languages for language-specific processing steps, such as word detection and dictionary settings. **You should always specify an indexing language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/).
34
- attr_accessor :index_languages
35
-
36
- # Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). Attribute names are case-sensitive.
37
- attr_accessor :disable_prefix_on_attributes
38
-
39
- # Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered.
40
- attr_accessor :allow_compression_of_integer_array
41
-
42
- # Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). Attribute names are case-sensitive. By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes. If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn't exist in your index, such as `NO_NUMERIC_FILTERING`. **Modifier** - `equalOnly(\"ATTRIBUTE\")`. Support only filtering based on equality comparisons `=` and `!=`.
43
- attr_accessor :numeric_attributes_for_filtering
44
-
45
- # Controls which separators are indexed. Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren't indexed. With `separatorsToIndex`, Algolia treats separator characters as separate words. For example, a search for `C#` would report two matches.
46
- attr_accessor :separators_to_index
47
-
48
- # Attributes used for searching. Attribute names are case-sensitive. By default, all attributes are searchable and the [Attribute](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute) ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of `searchableAttributes` rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as `\"title,alternate_title\"`. Attributes with the same priority are always unordered. For more information, see [Searchable attributes](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/setting-searchable-attributes/). **Modifier** - `unordered(\"ATTRIBUTE\")`. Ignore the position of a match within the attribute. Without modifier, matches at the beginning of an attribute rank higer than matches at the end.
49
- attr_accessor :searchable_attributes
50
-
51
- # An object with custom data. You can store up to 32kB as custom data.
52
- attr_accessor :user_data
53
-
54
- # Characters and their normalized replacements. This overrides Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).
55
- attr_accessor :custom_normalization
56
-
57
- # Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts.
58
- attr_accessor :attribute_for_distinct
59
-
60
- # Attribute mapping from ruby-style variable name to JSON key.
61
- def self.attribute_map
62
- {
63
- :attributes_for_faceting => :attributesForFaceting,
64
- :replicas => :replicas,
65
- :pagination_limited_to => :paginationLimitedTo,
66
- :unretrievable_attributes => :unretrievableAttributes,
67
- :disable_typo_tolerance_on_words => :disableTypoToleranceOnWords,
68
- :attributes_to_transliterate => :attributesToTransliterate,
69
- :camel_case_attributes => :camelCaseAttributes,
70
- :decompounded_attributes => :decompoundedAttributes,
71
- :index_languages => :indexLanguages,
72
- :disable_prefix_on_attributes => :disablePrefixOnAttributes,
73
- :allow_compression_of_integer_array => :allowCompressionOfIntegerArray,
74
- :numeric_attributes_for_filtering => :numericAttributesForFiltering,
75
- :separators_to_index => :separatorsToIndex,
76
- :searchable_attributes => :searchableAttributes,
77
- :user_data => :userData,
78
- :custom_normalization => :customNormalization,
79
- :attribute_for_distinct => :attributeForDistinct
80
- }
81
- end
82
-
83
- # Returns all the JSON keys this model knows about
84
- def self.acceptable_attributes
85
- attribute_map.values
86
- end
87
-
88
- # Attribute type mapping.
89
- def self.types_mapping
90
- {
91
- :attributes_for_faceting => :"Array<String>",
92
- :replicas => :"Array<String>",
93
- :pagination_limited_to => :"Integer",
94
- :unretrievable_attributes => :"Array<String>",
95
- :disable_typo_tolerance_on_words => :"Array<String>",
96
- :attributes_to_transliterate => :"Array<String>",
97
- :camel_case_attributes => :"Array<String>",
98
- :decompounded_attributes => :"Object",
99
- :index_languages => :"Array<SupportedLanguage>",
100
- :disable_prefix_on_attributes => :"Array<String>",
101
- :allow_compression_of_integer_array => :"Boolean",
102
- :numeric_attributes_for_filtering => :"Array<String>",
103
- :separators_to_index => :"String",
104
- :searchable_attributes => :"Array<String>",
105
- :user_data => :"Object",
106
- :custom_normalization => :"Hash<String, Hash<String, String>>",
107
- :attribute_for_distinct => :"String"
108
- }
109
- end
110
-
111
- # List of attributes with nullable: true
112
- def self.openapi_nullable
113
- Set.new(
114
- []
115
- )
116
- end
117
-
118
- # Initializes the object
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- def initialize(attributes = {})
121
- if (!attributes.is_a?(Hash))
122
- raise(
123
- ArgumentError,
124
- "The input argument (attributes) must be a hash in `Algolia::BaseIndexSettings` initialize method"
125
- )
126
- end
127
-
128
- # check to see if the attribute exists and convert string to symbol for hash key
129
- attributes = attributes.each_with_object({}) { |(k, v), h|
130
- if (!self.class.attribute_map.key?(k.to_sym))
131
- raise(
132
- ArgumentError,
133
- "`#{k}` is not a valid attribute in `Algolia::BaseIndexSettings`. Please check the name to make sure it's valid. List of attributes: " +
134
- self.class.attribute_map.keys.inspect
135
- )
136
- end
137
-
138
- h[k.to_sym] = v
139
- }
140
-
141
- if attributes.key?(:attributes_for_faceting)
142
- if (value = attributes[:attributes_for_faceting]).is_a?(Array)
143
- self.attributes_for_faceting = value
144
- end
145
- end
146
-
147
- if attributes.key?(:replicas)
148
- if (value = attributes[:replicas]).is_a?(Array)
149
- self.replicas = value
150
- end
151
- end
152
-
153
- if attributes.key?(:pagination_limited_to)
154
- self.pagination_limited_to = attributes[:pagination_limited_to]
155
- end
156
-
157
- if attributes.key?(:unretrievable_attributes)
158
- if (value = attributes[:unretrievable_attributes]).is_a?(Array)
159
- self.unretrievable_attributes = value
160
- end
161
- end
162
-
163
- if attributes.key?(:disable_typo_tolerance_on_words)
164
- if (value = attributes[:disable_typo_tolerance_on_words]).is_a?(Array)
165
- self.disable_typo_tolerance_on_words = value
166
- end
167
- end
168
-
169
- if attributes.key?(:attributes_to_transliterate)
170
- if (value = attributes[:attributes_to_transliterate]).is_a?(Array)
171
- self.attributes_to_transliterate = value
172
- end
173
- end
174
-
175
- if attributes.key?(:camel_case_attributes)
176
- if (value = attributes[:camel_case_attributes]).is_a?(Array)
177
- self.camel_case_attributes = value
178
- end
179
- end
180
-
181
- if attributes.key?(:decompounded_attributes)
182
- self.decompounded_attributes = attributes[:decompounded_attributes]
183
- end
184
-
185
- if attributes.key?(:index_languages)
186
- if (value = attributes[:index_languages]).is_a?(Array)
187
- self.index_languages = value
188
- end
189
- end
190
-
191
- if attributes.key?(:disable_prefix_on_attributes)
192
- if (value = attributes[:disable_prefix_on_attributes]).is_a?(Array)
193
- self.disable_prefix_on_attributes = value
194
- end
195
- end
196
-
197
- if attributes.key?(:allow_compression_of_integer_array)
198
- self.allow_compression_of_integer_array = attributes[:allow_compression_of_integer_array]
199
- end
200
-
201
- if attributes.key?(:numeric_attributes_for_filtering)
202
- if (value = attributes[:numeric_attributes_for_filtering]).is_a?(Array)
203
- self.numeric_attributes_for_filtering = value
204
- end
205
- end
206
-
207
- if attributes.key?(:separators_to_index)
208
- self.separators_to_index = attributes[:separators_to_index]
209
- end
210
-
211
- if attributes.key?(:searchable_attributes)
212
- if (value = attributes[:searchable_attributes]).is_a?(Array)
213
- self.searchable_attributes = value
214
- end
215
- end
216
-
217
- if attributes.key?(:user_data)
218
- self.user_data = attributes[:user_data]
219
- end
220
-
221
- if attributes.key?(:custom_normalization)
222
- if (value = attributes[:custom_normalization]).is_a?(Hash)
223
- self.custom_normalization = value
224
- end
225
- end
226
-
227
- if attributes.key?(:attribute_for_distinct)
228
- self.attribute_for_distinct = attributes[:attribute_for_distinct]
229
- end
230
- end
231
-
232
- # Custom attribute writer method with validation
233
- # @param [Object] pagination_limited_to Value to be assigned
234
- def pagination_limited_to=(pagination_limited_to)
235
- if pagination_limited_to.nil?
236
- raise ArgumentError, "pagination_limited_to cannot be nil"
237
- end
238
-
239
- if pagination_limited_to > 20000
240
- raise ArgumentError, "invalid value for \"pagination_limited_to\", must be smaller than or equal to 20000."
241
- end
242
-
243
- @pagination_limited_to = pagination_limited_to
244
- end
245
-
246
- # Checks equality by comparing each attribute.
247
- # @param [Object] Object to be compared
248
- def ==(other)
249
- return true if self.equal?(other)
250
- self.class == other.class &&
251
- attributes_for_faceting == other.attributes_for_faceting &&
252
- replicas == other.replicas &&
253
- pagination_limited_to == other.pagination_limited_to &&
254
- unretrievable_attributes == other.unretrievable_attributes &&
255
- disable_typo_tolerance_on_words == other.disable_typo_tolerance_on_words &&
256
- attributes_to_transliterate == other.attributes_to_transliterate &&
257
- camel_case_attributes == other.camel_case_attributes &&
258
- decompounded_attributes == other.decompounded_attributes &&
259
- index_languages == other.index_languages &&
260
- disable_prefix_on_attributes == other.disable_prefix_on_attributes &&
261
- allow_compression_of_integer_array == other.allow_compression_of_integer_array &&
262
- numeric_attributes_for_filtering == other.numeric_attributes_for_filtering &&
263
- separators_to_index == other.separators_to_index &&
264
- searchable_attributes == other.searchable_attributes &&
265
- user_data == other.user_data &&
266
- custom_normalization == other.custom_normalization &&
267
- attribute_for_distinct == other.attribute_for_distinct
268
- end
269
-
270
- # @see the `==` method
271
- # @param [Object] Object to be compared
272
- def eql?(other)
273
- self == other
274
- end
275
-
276
- # Calculates hash code according to all attributes.
277
- # @return [Integer] Hash code
278
- def hash
279
- [
280
- attributes_for_faceting,
281
- replicas,
282
- pagination_limited_to,
283
- unretrievable_attributes,
284
- disable_typo_tolerance_on_words,
285
- attributes_to_transliterate,
286
- camel_case_attributes,
287
- decompounded_attributes,
288
- index_languages,
289
- disable_prefix_on_attributes,
290
- allow_compression_of_integer_array,
291
- numeric_attributes_for_filtering,
292
- separators_to_index,
293
- searchable_attributes,
294
- user_data,
295
- custom_normalization,
296
- attribute_for_distinct
297
- ].hash
298
- end
299
-
300
- # Builds the object from hash
301
- # @param [Hash] attributes Model attributes in the form of hash
302
- # @return [Object] Returns the model itself
303
- def self.build_from_hash(attributes)
304
- return nil unless attributes.is_a?(Hash)
305
- attributes = attributes.transform_keys(&:to_sym)
306
- transformed_hash = {}
307
- types_mapping.each_pair do |key, type|
308
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
309
- transformed_hash[key.to_sym] = nil
310
- elsif type =~ /\AArray<(.*)>/i
311
- # check to ensure the input is an array given that the attribute
312
- # is documented as an array but the input is not
313
- if attributes[attribute_map[key]].is_a?(Array)
314
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
315
- _deserialize(::Regexp.last_match(1), v)
316
- }
317
- end
318
- elsif !attributes[attribute_map[key]].nil?
319
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
320
- end
321
- end
322
-
323
- new(transformed_hash)
324
- end
325
-
326
- # Deserializes the data based on type
327
- # @param string type Data type
328
- # @param string value Value to be deserialized
329
- # @return [Object] Deserialized data
330
- def self._deserialize(type, value)
331
- case type.to_sym
332
- when :Time
333
- Time.parse(value)
334
- when :Date
335
- Date.parse(value)
336
- when :String
337
- value.to_s
338
- when :Integer
339
- value.to_i
340
- when :Float
341
- value.to_f
342
- when :Boolean
343
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
344
- true
345
- else
346
- false
347
- end
348
-
349
- when :Object
350
- # generic object (usually a Hash), return directly
351
- value
352
- when /\AArray<(?<inner_type>.+)>\z/
353
- inner_type = Regexp.last_match[:inner_type]
354
- value.map { |v| _deserialize(inner_type, v) }
355
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
356
- k_type = Regexp.last_match[:k_type]
357
- v_type = Regexp.last_match[:v_type]
358
- {}.tap do |hash|
359
- value.each do |k, v|
360
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
361
- end
362
- end
363
- # model
364
- else
365
- # models (e.g. Pet) or oneOf
366
- klass = Algolia::Search.const_get(type)
367
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
368
- .build_from_hash(value)
369
- end
370
- end
371
-
372
- # Returns the string representation of the object
373
- # @return [String] String presentation of the object
374
- def to_s
375
- to_hash.to_s
376
- end
377
-
378
- # to_body is an alias to to_hash (backward compatibility)
379
- # @return [Hash] Returns the object in the form of hash
380
- def to_body
381
- to_hash
382
- end
383
-
384
- def to_json(*_args)
385
- to_hash.to_json
386
- end
387
-
388
- # Returns the object in the form of hash
389
- # @return [Hash] Returns the object in the form of hash
390
- def to_hash
391
- hash = {}
392
- self.class.attribute_map.each_pair do |attr, param|
393
- value = send(attr)
394
- if value.nil?
395
- is_nullable = self.class.openapi_nullable.include?(attr)
396
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
397
- end
398
-
399
- hash[param] = _to_hash(value)
400
- end
401
-
402
- hash
403
- end
404
-
405
- # Outputs non-array value in the form of hash
406
- # For object, use to_hash. Otherwise, just return the value
407
- # @param [Object] value Any valid value
408
- # @return [Hash] Returns the value in the form of hash
409
- def _to_hash(value)
410
- if value.is_a?(Array)
411
- value.compact.map { |v| _to_hash(v) }
412
- elsif value.is_a?(Hash)
413
- {}.tap do |hash|
414
- value.each { |k, v| hash[k] = _to_hash(v) }
415
- end
416
- elsif value.respond_to?(:to_hash)
417
- value.to_hash
418
- else
419
- value
420
- end
421
- end
422
-
423
- end
424
-
425
- end
426
- end