algolia 3.4.0 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -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 +32 -88
  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 +19 -74
  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.rb +218 -0
  70. data/lib/algolia/models/{query-suggestions/base_query_suggestions_configuration_response.rb → recommend/banner_image.rb} +31 -38
  71. data/lib/algolia/models/{query-suggestions/base_query_suggestions_configuration_with_index.rb → recommend/banner_image_url.rb} +23 -23
  72. data/lib/algolia/models/{query-suggestions/get_config_status200_response.rb → recommend/banner_link.rb} +13 -53
  73. data/lib/algolia/models/recommend/bought_together_query.rb +0 -36
  74. data/lib/algolia/models/recommend/condition.rb +0 -15
  75. data/lib/algolia/models/recommend/consequence.rb +0 -28
  76. data/lib/algolia/models/recommend/fallback_params.rb +8 -100
  77. data/lib/algolia/models/recommend/looking_similar_query.rb +0 -36
  78. data/lib/algolia/models/recommend/numeric_filters.rb +1 -1
  79. data/lib/algolia/models/recommend/promote_consequence_object.rb +0 -14
  80. data/lib/algolia/models/recommend/ranking_info.rb +0 -112
  81. data/lib/algolia/models/recommend/recommend_hit.rb +0 -18
  82. data/lib/algolia/models/recommend/recommend_search_params.rb +8 -100
  83. data/lib/algolia/models/recommend/recommendations_results.rb +0 -61
  84. data/lib/algolia/models/recommend/recommended_for_you_query.rb +0 -36
  85. data/lib/algolia/models/recommend/related_query.rb +0 -36
  86. data/lib/algolia/models/recommend/rendering_content.rb +14 -5
  87. data/lib/algolia/models/recommend/search_recommend_rules_params.rb +0 -50
  88. data/lib/algolia/models/recommend/search_recommend_rules_response.rb +0 -14
  89. data/lib/algolia/models/recommend/trending_facet_hit.rb +0 -18
  90. data/lib/algolia/models/recommend/trending_facets_query.rb +0 -36
  91. data/lib/algolia/models/recommend/trending_items_query.rb +0 -36
  92. data/lib/algolia/models/recommend/typo_tolerance.rb +1 -1
  93. data/lib/algolia/models/recommend/widgets.rb +212 -0
  94. data/lib/algolia/models/search/api_key.rb +1 -1
  95. data/lib/algolia/models/search/banner.rb +218 -0
  96. data/lib/algolia/models/{query-suggestions/get_log_file200_response.rb → search/banner_image.rb} +21 -61
  97. data/lib/algolia/models/search/banner_image_url.rb +212 -0
  98. data/lib/algolia/models/search/banner_link.rb +212 -0
  99. data/lib/algolia/models/search/browse_params_object.rb +4 -132
  100. data/lib/algolia/models/search/browse_response.rb +0 -61
  101. data/lib/algolia/models/search/condition.rb +0 -15
  102. data/lib/algolia/models/search/consequence.rb +0 -28
  103. data/lib/algolia/models/search/consequence_params.rb +4 -132
  104. data/lib/algolia/models/search/delete_by_params.rb +1 -1
  105. data/lib/algolia/models/search/get_api_key_response.rb +1 -1
  106. data/lib/algolia/models/search/index_settings.rb +7 -85
  107. data/lib/algolia/models/search/log.rb +0 -34
  108. data/lib/algolia/models/search/numeric_filters.rb +1 -1
  109. data/lib/algolia/models/search/promote_object_ids.rb +0 -14
  110. data/lib/algolia/models/search/ranking_info.rb +0 -112
  111. data/lib/algolia/models/search/rendering_content.rb +14 -5
  112. data/lib/algolia/models/search/rule.rb +0 -18
  113. data/lib/algolia/models/search/search_dictionary_entries_params.rb +0 -32
  114. data/lib/algolia/models/search/search_dictionary_entries_response.rb +0 -14
  115. data/lib/algolia/models/search/search_for_facet_values_request.rb +0 -14
  116. data/lib/algolia/models/search/search_for_facets.rb +4 -132
  117. data/lib/algolia/models/search/search_for_hits.rb +4 -132
  118. data/lib/algolia/models/search/search_params_object.rb +4 -132
  119. data/lib/algolia/models/search/search_response.rb +0 -61
  120. data/lib/algolia/models/search/search_rules_params.rb +0 -32
  121. data/lib/algolia/models/search/search_synonyms_params.rb +0 -32
  122. data/lib/algolia/models/search/search_user_ids_params.rb +0 -32
  123. data/lib/algolia/models/search/search_user_ids_response.rb +0 -32
  124. data/lib/algolia/models/search/settings_response.rb +7 -85
  125. data/lib/algolia/models/search/typo_tolerance.rb +1 -1
  126. data/lib/algolia/models/search/user_hit.rb +0 -15
  127. data/lib/algolia/models/search/user_id.rb +0 -15
  128. data/lib/algolia/models/search/widgets.rb +212 -0
  129. data/lib/algolia/version.rb +1 -1
  130. metadata +12 -9
  131. data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +0 -276
  132. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +0 -316
  133. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +0 -295
@@ -129,111 +129,6 @@ module Algolia
129
129
  end
130
130
  end
131
131
 
132
- # Custom attribute writer method with validation
133
- # @param [Object] event_name Value to be assigned
134
- def event_name=(event_name)
135
- if event_name.nil?
136
- raise ArgumentError, "event_name cannot be nil"
137
- end
138
-
139
- if event_name.to_s.length > 64
140
- raise(
141
- ArgumentError,
142
- "invalid value for \"event_name\", the character length must be smaller than or equal to 64."
143
- )
144
- end
145
-
146
- if event_name.to_s.length < 1
147
- raise(
148
- ArgumentError,
149
- "invalid value for \"event_name\", the character length must be great than or equal to 1."
150
- )
151
- end
152
-
153
- pattern = /[\x20-\x7E]{1,64}/
154
- if event_name !~ pattern
155
- raise ArgumentError, "invalid value for \"event_name\", must conform to the pattern #{pattern}."
156
- end
157
-
158
- @event_name = event_name
159
- end
160
-
161
- # Custom attribute writer method with validation
162
- # @param [Object] object_ids Value to be assigned
163
- def object_ids=(object_ids)
164
- if object_ids.nil?
165
- raise ArgumentError, "object_ids cannot be nil"
166
- end
167
-
168
- if object_ids.length > 20
169
- raise ArgumentError, "invalid value for \"object_ids\", number of items must be less than or equal to 20."
170
- end
171
-
172
- if object_ids.length < 1
173
- raise ArgumentError, "invalid value for \"object_ids\", number of items must be greater than or equal to 1."
174
- end
175
-
176
- @object_ids = object_ids
177
- end
178
-
179
- # Custom attribute writer method with validation
180
- # @param [Object] user_token Value to be assigned
181
- def user_token=(user_token)
182
- if user_token.nil?
183
- raise ArgumentError, "user_token cannot be nil"
184
- end
185
-
186
- if user_token.to_s.length > 129
187
- raise(
188
- ArgumentError,
189
- "invalid value for \"user_token\", the character length must be smaller than or equal to 129."
190
- )
191
- end
192
-
193
- if user_token.to_s.length < 1
194
- raise(
195
- ArgumentError,
196
- "invalid value for \"user_token\", the character length must be great than or equal to 1."
197
- )
198
- end
199
-
200
- pattern = /[a-zA-Z0-9_=\/+-]{1,129}/
201
- if user_token !~ pattern
202
- raise ArgumentError, "invalid value for \"user_token\", must conform to the pattern #{pattern}."
203
- end
204
-
205
- @user_token = user_token
206
- end
207
-
208
- # Custom attribute writer method with validation
209
- # @param [Object] authenticated_user_token Value to be assigned
210
- def authenticated_user_token=(authenticated_user_token)
211
- if authenticated_user_token.nil?
212
- raise ArgumentError, "authenticated_user_token cannot be nil"
213
- end
214
-
215
- if authenticated_user_token.to_s.length > 129
216
- raise(
217
- ArgumentError,
218
- "invalid value for \"authenticated_user_token\", the character length must be smaller than or equal to 129."
219
- )
220
- end
221
-
222
- if authenticated_user_token.to_s.length < 1
223
- raise(
224
- ArgumentError,
225
- "invalid value for \"authenticated_user_token\", the character length must be great than or equal to 1."
226
- )
227
- end
228
-
229
- pattern = /[a-zA-Z0-9_=\/+-]{1,129}/
230
- if authenticated_user_token !~ pattern
231
- raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
232
- end
233
-
234
- @authenticated_user_token = authenticated_user_token
235
- end
236
-
237
132
  # Checks equality by comparing each attribute.
238
133
  # @param [Object] Object to be compared
239
134
  def ==(other)
@@ -91,24 +91,6 @@ module Algolia
91
91
  end
92
92
  end
93
93
 
94
- # Custom attribute writer method with validation
95
- # @param [Object] personalization_impact Value to be assigned
96
- def personalization_impact=(personalization_impact)
97
- if personalization_impact.nil?
98
- raise ArgumentError, "personalization_impact cannot be nil"
99
- end
100
-
101
- if personalization_impact > 100
102
- raise ArgumentError, "invalid value for \"personalization_impact\", must be smaller than or equal to 100."
103
- end
104
-
105
- if personalization_impact < 0
106
- raise ArgumentError, "invalid value for \"personalization_impact\", must be greater than or equal to 0."
107
- end
108
-
109
- @personalization_impact = personalization_impact
110
- end
111
-
112
94
  # Checks equality by comparing each attribute.
113
95
  # @param [Object] Object to be compared
114
96
  def ==(other)
@@ -106,23 +106,6 @@ module Algolia
106
106
  end
107
107
  end
108
108
 
109
- # Custom attribute writer method with validation
110
- # @param [Object] source_indices Value to be assigned
111
- def source_indices=(source_indices)
112
- if source_indices.nil?
113
- raise ArgumentError, "source_indices cannot be nil"
114
- end
115
-
116
- if source_indices.length < 1
117
- raise(
118
- ArgumentError,
119
- "invalid value for \"source_indices\", number of items must be greater than or equal to 1."
120
- )
121
- end
122
-
123
- @source_indices = source_indices
124
- end
125
-
126
109
  # Checks equality by comparing each attribute.
127
110
  # @param [Object] Object to be compared
128
111
  def ==(other)
@@ -144,23 +144,6 @@ module Algolia
144
144
  end
145
145
  end
146
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
147
  # Checks equality by comparing each attribute.
165
148
  # @param [Object] Object to be compared
166
149
  def ==(other)
@@ -124,23 +124,6 @@ module Algolia
124
124
  end
125
125
  end
126
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
127
  # Checks equality by comparing each attribute.
145
128
  # @param [Object] Object to be compared
146
129
  def ==(other)
@@ -138,34 +138,6 @@ module Algolia
138
138
  end
139
139
  end
140
140
 
141
- # Custom attribute writer method with validation
142
- # @param [Object] min_hits Value to be assigned
143
- def min_hits=(min_hits)
144
- if min_hits.nil?
145
- raise ArgumentError, "min_hits cannot be nil"
146
- end
147
-
148
- if min_hits < 0
149
- raise ArgumentError, "invalid value for \"min_hits\", must be greater than or equal to 0."
150
- end
151
-
152
- @min_hits = min_hits
153
- end
154
-
155
- # Custom attribute writer method with validation
156
- # @param [Object] min_letters Value to be assigned
157
- def min_letters=(min_letters)
158
- if min_letters.nil?
159
- raise ArgumentError, "min_letters cannot be nil"
160
- end
161
-
162
- if min_letters < 0
163
- raise ArgumentError, "invalid value for \"min_letters\", must be greater than or equal to 0."
164
- end
165
-
166
- @min_letters = min_letters
167
- end
168
-
169
141
  # Checks equality by comparing each attribute.
170
142
  # @param [Object] Object to be compared
171
143
  def ==(other)
@@ -0,0 +1,218 @@
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
+ # a search banner with image and url.
9
+ class Banner
10
+ attr_accessor :image
11
+
12
+ attr_accessor :link
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :image => :image,
18
+ :link => :link
19
+ }
20
+ end
21
+
22
+ # Returns all the JSON keys this model knows about
23
+ def self.acceptable_attributes
24
+ attribute_map.values
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.types_mapping
29
+ {
30
+ :image => :"BannerImage",
31
+ :link => :"BannerLink"
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new(
38
+ []
39
+ )
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Banner` initialize method"
47
+ end
48
+
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h|
51
+ if (!self.class.attribute_map.key?(k.to_sym))
52
+ raise(
53
+ ArgumentError,
54
+ "`#{k}` is not a valid attribute in `Algolia::Banner`. Please check the name to make sure it's valid. List of attributes: " +
55
+ self.class.attribute_map.keys.inspect
56
+ )
57
+ end
58
+
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:image)
63
+ self.image = attributes[:image]
64
+ end
65
+
66
+ if attributes.key?(:link)
67
+ self.link = attributes[:link]
68
+ end
69
+ end
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] Object to be compared
73
+ def ==(other)
74
+ return true if self.equal?(other)
75
+ self.class == other.class &&
76
+ image == other.image &&
77
+ link == other.link
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(other)
83
+ self == other
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [image, link].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ attributes = attributes.transform_keys(&:to_sym)
98
+ transformed_hash = {}
99
+ types_mapping.each_pair do |key, type|
100
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
101
+ transformed_hash[key.to_sym] = nil
102
+ elsif type =~ /\AArray<(.*)>/i
103
+ # check to ensure the input is an array given that the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[attribute_map[key]].is_a?(Array)
106
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
107
+ _deserialize(::Regexp.last_match(1), v)
108
+ }
109
+ end
110
+ elsif !attributes[attribute_map[key]].nil?
111
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
112
+ end
113
+ end
114
+
115
+ new(transformed_hash)
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param string type Data type
120
+ # @param string value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def self._deserialize(type, value)
123
+ case type.to_sym
124
+ when :Time
125
+ Time.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :Boolean
135
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ # model
156
+ else
157
+ # models (e.g. Pet) or oneOf
158
+ klass = Algolia::Recommend.const_get(type)
159
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
160
+ .build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ def to_json(*_args)
177
+ to_hash.to_json
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to?(:to_hash)
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
218
+ end
@@ -4,23 +4,18 @@ require "date"
4
4
  require "time"
5
5
 
6
6
  module Algolia
7
- module QuerySuggestions
8
- class BaseQuerySuggestionsConfigurationResponse
9
- # API key used to read from your source index.
10
- attr_accessor :source_indices_api_key
7
+ module Recommend
8
+ # image of a search banner.
9
+ class BannerImage
10
+ attr_accessor :urls
11
11
 
12
- # API key used to write and configure your Query Suggestions index.
13
- attr_accessor :suggestions_indices_api_key
14
-
15
- # API key used to read from external Algolia indices.
16
- attr_accessor :external_indices_api_key
12
+ attr_accessor :title
17
13
 
18
14
  # Attribute mapping from ruby-style variable name to JSON key.
19
15
  def self.attribute_map
20
16
  {
21
- :source_indices_api_key => :sourceIndicesAPIKey,
22
- :suggestions_indices_api_key => :suggestionsIndicesAPIKey,
23
- :external_indices_api_key => :externalIndicesAPIKey
17
+ :urls => :urls,
18
+ :title => :title
24
19
  }
25
20
  end
26
21
 
@@ -32,62 +27,59 @@ module Algolia
32
27
  # Attribute type mapping.
33
28
  def self.types_mapping
34
29
  {
35
- :source_indices_api_key => :String,
36
- :suggestions_indices_api_key => :String,
37
- :external_indices_api_key => :String
30
+ :urls => :"Array<BannerImageUrl>",
31
+ :title => :"String"
38
32
  }
39
33
  end
40
34
 
41
35
  # List of attributes with nullable: true
42
36
  def self.openapi_nullable
43
- Set.new([])
37
+ Set.new(
38
+ []
39
+ )
44
40
  end
45
41
 
46
42
  # Initializes the object
47
43
  # @param [Hash] attributes Model attributes in the form of hash
48
44
  def initialize(attributes = {})
49
- unless attributes.is_a?(Hash)
45
+ if (!attributes.is_a?(Hash))
50
46
  raise(
51
47
  ArgumentError,
52
- "The input argument (attributes) must be a hash in `Algolia::BaseQuerySuggestionsConfigurationResponse` initialize method"
48
+ "The input argument (attributes) must be a hash in `Algolia::BannerImage` initialize method"
53
49
  )
54
50
  end
55
51
 
56
52
  # check to see if the attribute exists and convert string to symbol for hash key
57
- attributes = attributes.each_with_object({}) do |(k, v), h|
58
- unless self.class.attribute_map.key?(k.to_sym)
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
59
55
  raise(
60
56
  ArgumentError,
61
- "`#{k}` is not a valid attribute in `Algolia::BaseQuerySuggestionsConfigurationResponse`. Please check the name to make sure it's valid. List of attributes: " +
57
+ "`#{k}` is not a valid attribute in `Algolia::BannerImage`. Please check the name to make sure it's valid. List of attributes: " +
62
58
  self.class.attribute_map.keys.inspect
63
59
  )
64
60
  end
65
61
 
66
62
  h[k.to_sym] = v
67
- end
68
-
69
- if attributes.key?(:source_indices_api_key)
70
- self.source_indices_api_key = attributes[:source_indices_api_key]
71
- end
63
+ }
72
64
 
73
- if attributes.key?(:suggestions_indices_api_key)
74
- self.suggestions_indices_api_key = attributes[:suggestions_indices_api_key]
65
+ if attributes.key?(:urls)
66
+ if (value = attributes[:urls]).is_a?(Array)
67
+ self.urls = value
68
+ end
75
69
  end
76
70
 
77
- if attributes.key?(:external_indices_api_key)
78
- self.external_indices_api_key = attributes[:external_indices_api_key]
71
+ if attributes.key?(:title)
72
+ self.title = attributes[:title]
79
73
  end
80
74
  end
81
75
 
82
76
  # Checks equality by comparing each attribute.
83
77
  # @param [Object] Object to be compared
84
78
  def ==(other)
85
- return true if equal?(other)
86
-
79
+ return true if self.equal?(other)
87
80
  self.class == other.class &&
88
- source_indices_api_key == other.source_indices_api_key &&
89
- suggestions_indices_api_key == other.suggestions_indices_api_key &&
90
- external_indices_api_key == other.external_indices_api_key
81
+ urls == other.urls &&
82
+ title == other.title
91
83
  end
92
84
 
93
85
  # @see the `==` method
@@ -99,7 +91,7 @@ module Algolia
99
91
  # Calculates hash code according to all attributes.
100
92
  # @return [Integer] Hash code
101
93
  def hash
102
- [source_indices_api_key, suggestions_indices_api_key, external_indices_api_key].hash
94
+ [urls, title].hash
103
95
  end
104
96
 
105
97
  # Builds the object from hash
@@ -107,7 +99,6 @@ module Algolia
107
99
  # @return [Object] Returns the model itself
108
100
  def self.build_from_hash(attributes)
109
101
  return nil unless attributes.is_a?(Hash)
110
-
111
102
  attributes = attributes.transform_keys(&:to_sym)
112
103
  transformed_hash = {}
113
104
  types_mapping.each_pair do |key, type|
@@ -169,7 +160,7 @@ module Algolia
169
160
  # model
170
161
  else
171
162
  # models (e.g. Pet) or oneOf
172
- klass = Algolia::QuerySuggestions.const_get(type)
163
+ klass = Algolia::Recommend.const_get(type)
173
164
  klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
174
165
  .build_from_hash(value)
175
166
  end
@@ -225,6 +216,8 @@ module Algolia
225
216
  value
226
217
  end
227
218
  end
219
+
228
220
  end
221
+
229
222
  end
230
223
  end