algolia 3.5.0 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/algolia/api/abtesting_client.rb +0 -7
  5. data/lib/algolia/api/analytics_client.rb +0 -168
  6. data/lib/algolia/api/ingestion_client.rb +2 -170
  7. data/lib/algolia/api/insights_client.rb +0 -22
  8. data/lib/algolia/api/monitoring_client.rb +11 -11
  9. data/lib/algolia/api/search_client.rb +3 -58
  10. data/lib/algolia/models/abtesting/ab_tests_variant.rb +0 -18
  11. data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +0 -18
  12. data/lib/algolia/models/abtesting/add_ab_tests_request.rb +0 -18
  13. data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +0 -18
  14. data/lib/algolia/models/abtesting/schedule_ab_tests_request.rb +0 -18
  15. data/lib/algolia/models/abtesting/variant.rb +0 -18
  16. data/lib/algolia/models/analytics/click_position.rb +0 -32
  17. data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +0 -28
  18. data/lib/algolia/models/analytics/daily_average_clicks.rb +0 -24
  19. data/lib/algolia/models/analytics/daily_click_through_rates.rb +0 -28
  20. data/lib/algolia/models/analytics/daily_conversion_rates.rb +0 -28
  21. data/lib/algolia/models/analytics/daily_no_click_rates.rb +0 -32
  22. data/lib/algolia/models/analytics/daily_no_results_rates.rb +0 -18
  23. data/lib/algolia/models/analytics/daily_purchase_rates.rb +0 -14
  24. data/lib/algolia/models/analytics/daily_searches_no_clicks.rb +0 -14
  25. data/lib/algolia/models/analytics/daily_searches_no_results.rb +0 -14
  26. data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +0 -28
  27. data/lib/algolia/models/analytics/get_average_click_position_response.rb +0 -24
  28. data/lib/algolia/models/analytics/get_click_positions_response.rb +0 -18
  29. data/lib/algolia/models/analytics/get_click_through_rate_response.rb +0 -28
  30. data/lib/algolia/models/analytics/get_conversion_rate_response.rb +0 -28
  31. data/lib/algolia/models/analytics/get_no_click_rate_response.rb +0 -32
  32. data/lib/algolia/models/analytics/get_no_results_rate_response.rb +0 -18
  33. data/lib/algolia/models/analytics/get_purchase_rate_response.rb +0 -14
  34. data/lib/algolia/models/analytics/top_hit_with_analytics.rb +0 -56
  35. data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +0 -98
  36. data/lib/algolia/models/analytics/top_search_with_analytics.rb +0 -90
  37. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +0 -132
  38. data/lib/algolia/models/ingestion/event.rb +0 -14
  39. data/lib/algolia/models/ingestion/pagination.rb +0 -60
  40. data/lib/algolia/models/ingestion/run.rb +0 -18
  41. data/lib/algolia/models/ingestion/source_csv.rb +0 -21
  42. data/lib/algolia/models/ingestion/task.rb +0 -18
  43. data/lib/algolia/models/ingestion/task_create.rb +0 -18
  44. data/lib/algolia/models/ingestion/task_create_v1.rb +0 -18
  45. data/lib/algolia/models/ingestion/task_update.rb +0 -18
  46. data/lib/algolia/models/ingestion/task_update_v1.rb +0 -18
  47. data/lib/algolia/models/ingestion/task_v1.rb +0 -18
  48. data/lib/algolia/models/ingestion/transformation.rb +1 -1
  49. data/lib/algolia/models/ingestion/transformation_create.rb +1 -1
  50. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +0 -123
  51. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +0 -149
  52. data/lib/algolia/models/insights/clicked_filters.rb +0 -105
  53. data/lib/algolia/models/insights/clicked_object_ids.rb +0 -105
  54. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +0 -149
  55. data/lib/algolia/models/insights/converted_filters.rb +0 -105
  56. data/lib/algolia/models/insights/converted_object_ids.rb +0 -105
  57. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +0 -131
  58. data/lib/algolia/models/insights/insights_events.rb +0 -18
  59. data/lib/algolia/models/insights/object_data_after_search.rb +0 -26
  60. data/lib/algolia/models/insights/purchased_object_ids.rb +0 -123
  61. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +0 -123
  62. data/lib/algolia/models/insights/viewed_filters.rb +0 -105
  63. data/lib/algolia/models/insights/viewed_object_ids.rb +0 -105
  64. data/lib/algolia/models/personalization/personalization_strategy_params.rb +0 -18
  65. data/lib/algolia/models/query-suggestions/configuration.rb +0 -17
  66. data/lib/algolia/models/query-suggestions/configuration_response.rb +0 -17
  67. data/lib/algolia/models/query-suggestions/configuration_with_index.rb +0 -17
  68. data/lib/algolia/models/query-suggestions/source_index.rb +0 -28
  69. data/lib/algolia/models/recommend/banner_image.rb +4 -2
  70. data/lib/algolia/models/recommend/bought_together_query.rb +0 -36
  71. data/lib/algolia/models/recommend/condition.rb +0 -15
  72. data/lib/algolia/models/recommend/consequence.rb +0 -28
  73. data/lib/algolia/models/recommend/fallback_params.rb +0 -92
  74. data/lib/algolia/models/recommend/looking_similar_query.rb +0 -36
  75. data/lib/algolia/models/recommend/promote_consequence_object.rb +0 -14
  76. data/lib/algolia/models/recommend/ranking_info.rb +0 -112
  77. data/lib/algolia/models/recommend/recommend_hit.rb +0 -18
  78. data/lib/algolia/models/recommend/recommend_search_params.rb +0 -92
  79. data/lib/algolia/models/recommend/recommendations_results.rb +0 -61
  80. data/lib/algolia/models/recommend/recommended_for_you_query.rb +0 -36
  81. data/lib/algolia/models/recommend/related_query.rb +0 -36
  82. data/lib/algolia/models/recommend/search_recommend_rules_params.rb +0 -50
  83. data/lib/algolia/models/recommend/search_recommend_rules_response.rb +0 -14
  84. data/lib/algolia/models/recommend/trending_facet_hit.rb +0 -18
  85. data/lib/algolia/models/recommend/trending_facets_query.rb +0 -36
  86. data/lib/algolia/models/recommend/trending_items_query.rb +0 -36
  87. data/lib/algolia/models/recommend/widgets.rb +5 -2
  88. data/lib/algolia/models/search/banner_image.rb +4 -2
  89. data/lib/algolia/models/search/browse_params_object.rb +0 -128
  90. data/lib/algolia/models/search/browse_response.rb +0 -61
  91. data/lib/algolia/models/search/condition.rb +0 -15
  92. data/lib/algolia/models/search/consequence.rb +0 -28
  93. data/lib/algolia/models/search/consequence_params.rb +0 -128
  94. data/lib/algolia/models/search/index_settings.rb +0 -78
  95. data/lib/algolia/models/search/log.rb +0 -34
  96. data/lib/algolia/models/search/promote_object_ids.rb +0 -14
  97. data/lib/algolia/models/search/ranking_info.rb +0 -112
  98. data/lib/algolia/models/search/rule.rb +0 -18
  99. data/lib/algolia/models/search/search_dictionary_entries_params.rb +0 -32
  100. data/lib/algolia/models/search/search_dictionary_entries_response.rb +0 -14
  101. data/lib/algolia/models/search/search_for_facet_values_request.rb +0 -14
  102. data/lib/algolia/models/search/search_for_facets.rb +0 -128
  103. data/lib/algolia/models/search/search_for_hits.rb +0 -128
  104. data/lib/algolia/models/search/search_params_object.rb +0 -128
  105. data/lib/algolia/models/search/search_response.rb +0 -61
  106. data/lib/algolia/models/search/search_rules_params.rb +0 -32
  107. data/lib/algolia/models/search/search_synonyms_params.rb +0 -32
  108. data/lib/algolia/models/search/search_user_ids_params.rb +0 -32
  109. data/lib/algolia/models/search/search_user_ids_response.rb +0 -32
  110. data/lib/algolia/models/search/settings_response.rb +0 -78
  111. data/lib/algolia/models/search/user_hit.rb +0 -15
  112. data/lib/algolia/models/search/user_id.rb +0 -15
  113. data/lib/algolia/models/search/widgets.rb +5 -2
  114. data/lib/algolia/version.rb +1 -1
  115. metadata +2 -11
  116. data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +0 -230
  117. data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +0 -212
  118. data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +0 -252
  119. data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +0 -263
  120. data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +0 -276
  121. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +0 -316
  122. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +0 -295
  123. data/lib/algolia/models/recommend/banners.rb +0 -209
  124. data/lib/algolia/models/search/banners.rb +0 -209
@@ -1,316 +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 QuerySuggestions
8
- # API response for retrieving Query Suggestions configurations.
9
- class QuerySuggestionsConfigurationResponse
10
- # Algolia application ID to which this Query Suggestions configuration belongs.
11
- attr_accessor :app_id
12
-
13
- # Name of the Query Suggestions index (case-sensitive).
14
- attr_accessor :index_name
15
-
16
- # Algolia indices from which to get the popular searches for query suggestions.
17
- attr_accessor :source_indices
18
-
19
- attr_accessor :languages
20
-
21
- attr_accessor :exclude
22
-
23
- # Whether to turn on personalized query suggestions.
24
- attr_accessor :enable_personalization
25
-
26
- # Whether to include suggestions with special characters.
27
- attr_accessor :allow_special_characters
28
-
29
- # Attribute mapping from ruby-style variable name to JSON key.
30
- def self.attribute_map
31
- {
32
- :app_id => :appID,
33
- :index_name => :indexName,
34
- :source_indices => :sourceIndices,
35
- :languages => :languages,
36
- :exclude => :exclude,
37
- :enable_personalization => :enablePersonalization,
38
- :allow_special_characters => :allowSpecialCharacters
39
- }
40
- end
41
-
42
- # Returns all the JSON keys this model knows about
43
- def self.acceptable_attributes
44
- attribute_map.values
45
- end
46
-
47
- # Attribute type mapping.
48
- def self.types_mapping
49
- {
50
- :app_id => :String,
51
- :index_name => :String,
52
- :source_indices => :"Array<SourceIndex>",
53
- :languages => :Languages,
54
- :exclude => :"Array<String>",
55
- :enable_personalization => :Boolean,
56
- :allow_special_characters => :Boolean
57
- }
58
- end
59
-
60
- # List of attributes with nullable: true
61
- def self.openapi_nullable
62
- Set.new(
63
- [
64
- :exclude
65
- ]
66
- )
67
- end
68
-
69
- # List of class defined in allOf (OpenAPI v3)
70
- def self.openapi_all_of
71
- [
72
- :AppID,
73
- :QuerySuggestionsConfigurationWithIndex
74
- ]
75
- end
76
-
77
- # Initializes the object
78
- # @param [Hash] attributes Model attributes in the form of hash
79
- def initialize(attributes = {})
80
- unless attributes.is_a?(Hash)
81
- raise(
82
- ArgumentError,
83
- "The input argument (attributes) must be a hash in `Algolia::QuerySuggestionsConfigurationResponse` initialize method"
84
- )
85
- end
86
-
87
- # check to see if the attribute exists and convert string to symbol for hash key
88
- attributes = attributes.each_with_object({}) do |(k, v), h|
89
- unless self.class.attribute_map.key?(k.to_sym)
90
- raise(
91
- ArgumentError,
92
- "`#{k}` is not a valid attribute in `Algolia::QuerySuggestionsConfigurationResponse`. Please check the name to make sure it's valid. List of attributes: " +
93
- self.class.attribute_map.keys.inspect
94
- )
95
- end
96
-
97
- h[k.to_sym] = v
98
- end
99
-
100
- if attributes.key?(:app_id)
101
- self.app_id = attributes[:app_id]
102
- else
103
- self.app_id = nil
104
- end
105
-
106
- if attributes.key?(:index_name)
107
- self.index_name = attributes[:index_name]
108
- else
109
- self.index_name = nil
110
- end
111
-
112
- if attributes.key?(:source_indices)
113
- if (value = attributes[:source_indices]).is_a?(Array)
114
- self.source_indices = value
115
- end
116
- else
117
- self.source_indices = nil
118
- end
119
-
120
- if attributes.key?(:languages)
121
- self.languages = attributes[:languages]
122
- else
123
- self.languages = nil
124
- end
125
-
126
- if attributes.key?(:exclude)
127
- if (value = attributes[:exclude]).is_a?(Array)
128
- self.exclude = value
129
- end
130
- else
131
- self.exclude = nil
132
- end
133
-
134
- if attributes.key?(:enable_personalization)
135
- self.enable_personalization = attributes[:enable_personalization]
136
- else
137
- self.enable_personalization = nil
138
- end
139
-
140
- if attributes.key?(:allow_special_characters)
141
- self.allow_special_characters = attributes[:allow_special_characters]
142
- else
143
- self.allow_special_characters = nil
144
- end
145
- end
146
-
147
- # Custom attribute writer method with validation
148
- # @param [Object] source_indices Value to be assigned
149
- def source_indices=(source_indices)
150
- if source_indices.nil?
151
- raise ArgumentError, "source_indices cannot be nil"
152
- end
153
-
154
- if source_indices.length < 1
155
- raise(
156
- ArgumentError,
157
- "invalid value for \"source_indices\", number of items must be greater than or equal to 1."
158
- )
159
- end
160
-
161
- @source_indices = source_indices
162
- end
163
-
164
- # Checks equality by comparing each attribute.
165
- # @param [Object] Object to be compared
166
- def ==(other)
167
- return true if equal?(other)
168
-
169
- self.class == other.class &&
170
- app_id == other.app_id &&
171
- index_name == other.index_name &&
172
- source_indices == other.source_indices &&
173
- languages == other.languages &&
174
- exclude == other.exclude &&
175
- enable_personalization == other.enable_personalization &&
176
- allow_special_characters == other.allow_special_characters
177
- end
178
-
179
- # @see the `==` method
180
- # @param [Object] Object to be compared
181
- def eql?(other)
182
- self == other
183
- end
184
-
185
- # Calculates hash code according to all attributes.
186
- # @return [Integer] Hash code
187
- def hash
188
- [app_id, index_name, source_indices, languages, exclude, enable_personalization, allow_special_characters].hash
189
- end
190
-
191
- # Builds the object from hash
192
- # @param [Hash] attributes Model attributes in the form of hash
193
- # @return [Object] Returns the model itself
194
- def self.build_from_hash(attributes)
195
- return nil unless attributes.is_a?(Hash)
196
-
197
- attributes = attributes.transform_keys(&:to_sym)
198
- transformed_hash = {}
199
- types_mapping.each_pair do |key, type|
200
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
201
- transformed_hash[key.to_sym] = nil
202
- elsif type =~ /\AArray<(.*)>/i
203
- # check to ensure the input is an array given that the attribute
204
- # is documented as an array but the input is not
205
- if attributes[attribute_map[key]].is_a?(Array)
206
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
207
- _deserialize(::Regexp.last_match(1), v)
208
- }
209
- end
210
- elsif !attributes[attribute_map[key]].nil?
211
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
212
- end
213
- end
214
-
215
- new(transformed_hash)
216
- end
217
-
218
- # Deserializes the data based on type
219
- # @param string type Data type
220
- # @param string value Value to be deserialized
221
- # @return [Object] Deserialized data
222
- def self._deserialize(type, value)
223
- case type.to_sym
224
- when :Time
225
- Time.parse(value)
226
- when :Date
227
- Date.parse(value)
228
- when :String
229
- value.to_s
230
- when :Integer
231
- value.to_i
232
- when :Float
233
- value.to_f
234
- when :Boolean
235
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
- true
237
- else
238
- false
239
- end
240
-
241
- when :Object
242
- # generic object (usually a Hash), return directly
243
- value
244
- when /\AArray<(?<inner_type>.+)>\z/
245
- inner_type = Regexp.last_match[:inner_type]
246
- value.map { |v| _deserialize(inner_type, v) }
247
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
- k_type = Regexp.last_match[:k_type]
249
- v_type = Regexp.last_match[:v_type]
250
- {}.tap do |hash|
251
- value.each do |k, v|
252
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
- end
254
- end
255
- # model
256
- else
257
- # models (e.g. Pet) or oneOf
258
- klass = Algolia::QuerySuggestions.const_get(type)
259
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
260
- .build_from_hash(value)
261
- end
262
- end
263
-
264
- # Returns the string representation of the object
265
- # @return [String] String presentation of the object
266
- def to_s
267
- to_hash.to_s
268
- end
269
-
270
- # to_body is an alias to to_hash (backward compatibility)
271
- # @return [Hash] Returns the object in the form of hash
272
- def to_body
273
- to_hash
274
- end
275
-
276
- def to_json(*_args)
277
- to_hash.to_json
278
- end
279
-
280
- # Returns the object in the form of hash
281
- # @return [Hash] Returns the object in the form of hash
282
- def to_hash
283
- hash = {}
284
- self.class.attribute_map.each_pair do |attr, param|
285
- value = send(attr)
286
- if value.nil?
287
- is_nullable = self.class.openapi_nullable.include?(attr)
288
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
289
- end
290
-
291
- hash[param] = _to_hash(value)
292
- end
293
-
294
- hash
295
- end
296
-
297
- # Outputs non-array value in the form of hash
298
- # For object, use to_hash. Otherwise, just return the value
299
- # @param [Object] value Any valid value
300
- # @return [Hash] Returns the value in the form of hash
301
- def _to_hash(value)
302
- if value.is_a?(Array)
303
- value.compact.map { |v| _to_hash(v) }
304
- elsif value.is_a?(Hash)
305
- {}.tap do |hash|
306
- value.each { |k, v| hash[k] = _to_hash(v) }
307
- end
308
- elsif value.respond_to?(:to_hash)
309
- value.to_hash
310
- else
311
- value
312
- end
313
- end
314
- end
315
- end
316
- end
@@ -1,295 +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 QuerySuggestions
8
- # Query Suggestions configuration.
9
- class QuerySuggestionsConfigurationWithIndex
10
- # Algolia indices from which to get the popular searches for query suggestions.
11
- attr_accessor :source_indices
12
-
13
- attr_accessor :languages
14
-
15
- attr_accessor :exclude
16
-
17
- # Whether to turn on personalized query suggestions.
18
- attr_accessor :enable_personalization
19
-
20
- # Whether to include suggestions with special characters.
21
- attr_accessor :allow_special_characters
22
-
23
- # Name of the Query Suggestions index (case-sensitive).
24
- attr_accessor :index_name
25
-
26
- # Attribute mapping from ruby-style variable name to JSON key.
27
- def self.attribute_map
28
- {
29
- :source_indices => :sourceIndices,
30
- :languages => :languages,
31
- :exclude => :exclude,
32
- :enable_personalization => :enablePersonalization,
33
- :allow_special_characters => :allowSpecialCharacters,
34
- :index_name => :indexName
35
- }
36
- end
37
-
38
- # Returns all the JSON keys this model knows about
39
- def self.acceptable_attributes
40
- attribute_map.values
41
- end
42
-
43
- # Attribute type mapping.
44
- def self.types_mapping
45
- {
46
- :source_indices => :"Array<SourceIndex>",
47
- :languages => :Languages,
48
- :exclude => :"Array<String>",
49
- :enable_personalization => :Boolean,
50
- :allow_special_characters => :Boolean,
51
- :index_name => :String
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new(
58
- [
59
- :exclude
60
- ]
61
- )
62
- end
63
-
64
- # List of class defined in allOf (OpenAPI v3)
65
- def self.openapi_all_of
66
- [
67
- :QuerySuggestionsConfiguration
68
- ]
69
- end
70
-
71
- # Initializes the object
72
- # @param [Hash] attributes Model attributes in the form of hash
73
- def initialize(attributes = {})
74
- unless attributes.is_a?(Hash)
75
- raise(
76
- ArgumentError,
77
- "The input argument (attributes) must be a hash in `Algolia::QuerySuggestionsConfigurationWithIndex` initialize method"
78
- )
79
- end
80
-
81
- # check to see if the attribute exists and convert string to symbol for hash key
82
- attributes = attributes.each_with_object({}) do |(k, v), h|
83
- unless self.class.attribute_map.key?(k.to_sym)
84
- raise(
85
- ArgumentError,
86
- "`#{k}` is not a valid attribute in `Algolia::QuerySuggestionsConfigurationWithIndex`. Please check the name to make sure it's valid. List of attributes: " +
87
- self.class.attribute_map.keys.inspect
88
- )
89
- end
90
-
91
- h[k.to_sym] = v
92
- end
93
-
94
- if attributes.key?(:source_indices)
95
- if (value = attributes[:source_indices]).is_a?(Array)
96
- self.source_indices = value
97
- end
98
- else
99
- self.source_indices = nil
100
- end
101
-
102
- if attributes.key?(:languages)
103
- self.languages = attributes[:languages]
104
- end
105
-
106
- if attributes.key?(:exclude)
107
- if (value = attributes[:exclude]).is_a?(Array)
108
- self.exclude = value
109
- end
110
- end
111
-
112
- if attributes.key?(:enable_personalization)
113
- self.enable_personalization = attributes[:enable_personalization]
114
- end
115
-
116
- if attributes.key?(:allow_special_characters)
117
- self.allow_special_characters = attributes[:allow_special_characters]
118
- end
119
-
120
- if attributes.key?(:index_name)
121
- self.index_name = attributes[:index_name]
122
- else
123
- self.index_name = nil
124
- end
125
- end
126
-
127
- # Custom attribute writer method with validation
128
- # @param [Object] source_indices Value to be assigned
129
- def source_indices=(source_indices)
130
- if source_indices.nil?
131
- raise ArgumentError, "source_indices cannot be nil"
132
- end
133
-
134
- if source_indices.length < 1
135
- raise(
136
- ArgumentError,
137
- "invalid value for \"source_indices\", number of items must be greater than or equal to 1."
138
- )
139
- end
140
-
141
- @source_indices = source_indices
142
- end
143
-
144
- # Checks equality by comparing each attribute.
145
- # @param [Object] Object to be compared
146
- def ==(other)
147
- return true if equal?(other)
148
-
149
- self.class == other.class &&
150
- source_indices == other.source_indices &&
151
- languages == other.languages &&
152
- exclude == other.exclude &&
153
- enable_personalization == other.enable_personalization &&
154
- allow_special_characters == other.allow_special_characters &&
155
- index_name == other.index_name
156
- end
157
-
158
- # @see the `==` method
159
- # @param [Object] Object to be compared
160
- def eql?(other)
161
- self == other
162
- end
163
-
164
- # Calculates hash code according to all attributes.
165
- # @return [Integer] Hash code
166
- def hash
167
- [source_indices, languages, exclude, enable_personalization, allow_special_characters, index_name].hash
168
- end
169
-
170
- # Builds the object from hash
171
- # @param [Hash] attributes Model attributes in the form of hash
172
- # @return [Object] Returns the model itself
173
- def self.build_from_hash(attributes)
174
- return nil unless attributes.is_a?(Hash)
175
-
176
- attributes = attributes.transform_keys(&:to_sym)
177
- transformed_hash = {}
178
- types_mapping.each_pair do |key, type|
179
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
180
- transformed_hash[key.to_sym] = nil
181
- elsif type =~ /\AArray<(.*)>/i
182
- # check to ensure the input is an array given that the attribute
183
- # is documented as an array but the input is not
184
- if attributes[attribute_map[key]].is_a?(Array)
185
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
186
- _deserialize(::Regexp.last_match(1), v)
187
- }
188
- end
189
- elsif !attributes[attribute_map[key]].nil?
190
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
191
- end
192
- end
193
-
194
- new(transformed_hash)
195
- end
196
-
197
- # Deserializes the data based on type
198
- # @param string type Data type
199
- # @param string value Value to be deserialized
200
- # @return [Object] Deserialized data
201
- def self._deserialize(type, value)
202
- case type.to_sym
203
- when :Time
204
- Time.parse(value)
205
- when :Date
206
- Date.parse(value)
207
- when :String
208
- value.to_s
209
- when :Integer
210
- value.to_i
211
- when :Float
212
- value.to_f
213
- when :Boolean
214
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
215
- true
216
- else
217
- false
218
- end
219
-
220
- when :Object
221
- # generic object (usually a Hash), return directly
222
- value
223
- when /\AArray<(?<inner_type>.+)>\z/
224
- inner_type = Regexp.last_match[:inner_type]
225
- value.map { |v| _deserialize(inner_type, v) }
226
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
- k_type = Regexp.last_match[:k_type]
228
- v_type = Regexp.last_match[:v_type]
229
- {}.tap do |hash|
230
- value.each do |k, v|
231
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
- end
233
- end
234
- # model
235
- else
236
- # models (e.g. Pet) or oneOf
237
- klass = Algolia::QuerySuggestions.const_get(type)
238
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
239
- .build_from_hash(value)
240
- end
241
- end
242
-
243
- # Returns the string representation of the object
244
- # @return [String] String presentation of the object
245
- def to_s
246
- to_hash.to_s
247
- end
248
-
249
- # to_body is an alias to to_hash (backward compatibility)
250
- # @return [Hash] Returns the object in the form of hash
251
- def to_body
252
- to_hash
253
- end
254
-
255
- def to_json(*_args)
256
- to_hash.to_json
257
- end
258
-
259
- # Returns the object in the form of hash
260
- # @return [Hash] Returns the object in the form of hash
261
- def to_hash
262
- hash = {}
263
- self.class.attribute_map.each_pair do |attr, param|
264
- value = send(attr)
265
- if value.nil?
266
- is_nullable = self.class.openapi_nullable.include?(attr)
267
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
268
- end
269
-
270
- hash[param] = _to_hash(value)
271
- end
272
-
273
- hash
274
- end
275
-
276
- # Outputs non-array value in the form of hash
277
- # For object, use to_hash. Otherwise, just return the value
278
- # @param [Object] value Any valid value
279
- # @return [Hash] Returns the value in the form of hash
280
- def _to_hash(value)
281
- if value.is_a?(Array)
282
- value.compact.map { |v| _to_hash(v) }
283
- elsif value.is_a?(Hash)
284
- {}.tap do |hash|
285
- value.each { |k, v| hash[k] = _to_hash(v) }
286
- end
287
- elsif value.respond_to?(:to_hash)
288
- value.to_hash
289
- else
290
- value
291
- end
292
- end
293
- end
294
- end
295
- end