algolia 3.37.1 → 3.38.0

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/algolia/api/monitoring_client.rb +2 -2
  5. data/lib/algolia/models/composition/{external.rb → injected_item_external.rb} +6 -3
  6. data/lib/algolia/models/composition/{external_source.rb → injected_item_external_source.rb} +4 -4
  7. data/lib/algolia/models/composition/injected_item_recommend_source.rb +216 -0
  8. data/lib/algolia/models/composition/{search.rb → injected_item_search.rb} +6 -3
  9. data/lib/algolia/models/composition/{search_source.rb → injected_item_search_source.rb} +4 -4
  10. data/lib/algolia/models/composition/injected_item_source.rb +3 -2
  11. data/lib/algolia/models/composition/injection.rb +2 -2
  12. data/lib/algolia/models/composition/{injected_item.rb → injection_injected_item.rb} +3 -3
  13. data/lib/algolia/models/composition/{main.rb → injection_main.rb} +8 -6
  14. data/lib/algolia/models/composition/injection_main_recommend_source.rb +216 -0
  15. data/lib/algolia/models/composition/{composition_source.rb → injection_main_search_source.rb} +12 -4
  16. data/lib/algolia/models/composition/injection_main_source.rb +109 -0
  17. data/lib/algolia/models/composition/main_recommend.rb +250 -0
  18. data/lib/algolia/models/composition/{composition_source_search.rb → main_search.rb} +4 -4
  19. data/lib/algolia/models/composition/model.rb +33 -0
  20. data/lib/algolia/models/composition/recommend.rb +250 -0
  21. data/lib/algolia/models/search/auto_filtering_filter_entry.rb +108 -0
  22. data/lib/algolia/models/search/auto_filtering_result.rb +242 -0
  23. data/lib/algolia/models/search/browse_response.rb +10 -0
  24. data/lib/algolia/models/search/category_prediction.rb +218 -0
  25. data/lib/algolia/models/search/category_prediction_bin.rb +37 -0
  26. data/lib/algolia/models/search/hierarchy_path_entry.rb +227 -0
  27. data/lib/algolia/models/search/query_categorization.rb +248 -0
  28. data/lib/algolia/models/search/query_categorization_type.rb +36 -0
  29. data/lib/algolia/models/search/response_extensions.rb +207 -0
  30. data/lib/algolia/models/search/search_extensions.rb +207 -0
  31. data/lib/algolia/models/search/search_extensions_query_categorization.rb +218 -0
  32. data/lib/algolia/models/search/search_for_hits.rb +14 -4
  33. data/lib/algolia/models/search/search_response.rb +14 -4
  34. data/lib/algolia/version.rb +1 -1
  35. metadata +25 -9
@@ -0,0 +1,216 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Composition
10
+ # Organic result set will originate from a recommend request.
11
+ class InjectionMainRecommendSource
12
+ attr_accessor :recommend
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :recommend => :recommend
18
+ }
19
+ end
20
+
21
+ # Returns the keys that uniquely identify this oneOf variant when present
22
+ def self.discriminator_attributes
23
+ [
24
+ :recommend
25
+ ]
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.types_mapping
30
+ {
31
+ :recommend => :"MainRecommend"
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(
47
+ ArgumentError,
48
+ "The input argument (attributes) must be a hash in `Algolia::InjectionMainRecommendSource` initialize method"
49
+ )
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ raise(
56
+ ArgumentError,
57
+ "`#{k}` is not a valid attribute in `Algolia::InjectionMainRecommendSource`. Please check the name to make sure it's valid. List of attributes: " +
58
+ self.class.attribute_map.keys.inspect
59
+ )
60
+ end
61
+
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:recommend)
66
+ self.recommend = attributes[:recommend]
67
+ else
68
+ self.recommend = nil
69
+ end
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(other)
75
+ return true if self.equal?(other)
76
+ self.class == other.class &&
77
+ recommend == other.recommend
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
+ [recommend].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::Composition.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
+ end
215
+ end
216
+ end
@@ -7,7 +7,8 @@ require "time"
7
7
 
8
8
  module Algolia
9
9
  module Composition
10
- class CompositionSource
10
+ # Organic result set will originate from a search request performed on the specified index.
11
+ class InjectionMainSearchSource
11
12
  attr_accessor :search
12
13
 
13
14
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -17,10 +18,17 @@ module Algolia
17
18
  }
18
19
  end
19
20
 
21
+ # Returns the keys that uniquely identify this oneOf variant when present
22
+ def self.discriminator_attributes
23
+ [
24
+ :search
25
+ ]
26
+ end
27
+
20
28
  # Attribute type mapping.
21
29
  def self.types_mapping
22
30
  {
23
- :search => :"CompositionSourceSearch"
31
+ :search => :"MainSearch"
24
32
  }
25
33
  end
26
34
 
@@ -37,7 +45,7 @@ module Algolia
37
45
  if (!attributes.is_a?(Hash))
38
46
  raise(
39
47
  ArgumentError,
40
- "The input argument (attributes) must be a hash in `Algolia::CompositionSource` initialize method"
48
+ "The input argument (attributes) must be a hash in `Algolia::InjectionMainSearchSource` initialize method"
41
49
  )
42
50
  end
43
51
 
@@ -46,7 +54,7 @@ module Algolia
46
54
  if (!self.class.attribute_map.key?(k.to_sym))
47
55
  raise(
48
56
  ArgumentError,
49
- "`#{k}` is not a valid attribute in `Algolia::CompositionSource`. Please check the name to make sure it's valid. List of attributes: " +
57
+ "`#{k}` is not a valid attribute in `Algolia::InjectionMainSearchSource`. Please check the name to make sure it's valid. List of attributes: " +
50
58
  self.class.attribute_map.keys.inspect
51
59
  )
52
60
  end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Composition
10
+ # Source to be used to retrieve organic result set.
11
+ module InjectionMainSource
12
+ class << self
13
+ # List of class defined in oneOf (OpenAPI v3)
14
+ def openapi_one_of
15
+ [
16
+ :"InjectionMainRecommendSource",
17
+ :"InjectionMainSearchSource"
18
+ ]
19
+ end
20
+
21
+ # Builds the object
22
+ # @param [Mixed] Data to be matched against the list of oneOf items
23
+ # @return [Object] Returns the model or the data itself
24
+ def build(data)
25
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
26
+ # Note:
27
+ # - We do not attempt to check whether exactly one item matches.
28
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
29
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
30
+ # - TODO: scalar values are de facto behaving as if they were nullable.
31
+ # - TODO: logging when debugging is set.
32
+ openapi_one_of.each do |klass|
33
+ begin
34
+ # "nullable: true"
35
+ next if klass == :AnyType
36
+ typed_data = find_and_cast_into_type(klass, data)
37
+ return typed_data if typed_data
38
+ # rescue all errors so we keep iterating even if the current item lookup raises
39
+ rescue
40
+ end
41
+ end
42
+
43
+ openapi_one_of.include?(:AnyType) ? data : nil
44
+ end
45
+
46
+ private
47
+
48
+ SchemaMismatchError = Class.new(StandardError)
49
+
50
+ def find_and_cast_into_type(klass, data)
51
+ return if data.nil?
52
+
53
+ case klass.to_s
54
+ when "Boolean"
55
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
56
+ when "Float"
57
+ return data if data.instance_of?(Float)
58
+ when "Integer"
59
+ return data if data.instance_of?(Integer)
60
+ when "Time"
61
+ return Time.parse(data)
62
+ when "Date"
63
+ return Date.parse(data)
64
+ when "String"
65
+ return data if data.instance_of?(String)
66
+ # "type: object"
67
+ when "Object"
68
+ return data if data.instance_of?(Hash)
69
+ # "type: array"
70
+ when /\AArray<(?<sub_type>.+)>\z/
71
+ if data.instance_of?(Array)
72
+ sub_type = Regexp.last_match[:sub_type]
73
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
74
+ end
75
+ # "type: object" with "additionalProperties: { ... }"
76
+ when /\AHash<String, (?<sub_type>.+)>\z/
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ # model
82
+ else
83
+ const = Algolia::Composition.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of)
86
+ # nested oneOf model
87
+ model = const.build(data)
88
+ elsif const.respond_to?(:discriminator_attributes)
89
+ if const.discriminator_attributes.all? { |attr| data.key?(attr) }
90
+ model = const.build_from_hash(data)
91
+ end
92
+ else
93
+ # maybe it's an enum, or doens't have discriminators
94
+ model = const.build_from_hash(data)
95
+ end
96
+
97
+ return model if model
98
+ end
99
+ end
100
+
101
+ # if no match by now, raise
102
+ raise
103
+ rescue
104
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,250 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Composition
10
+ class MainRecommend
11
+ # Index to retrieve recommendations from.
12
+ attr_accessor :index_name
13
+
14
+ attr_accessor :model
15
+
16
+ # Minimum score a recommendation must have to be included.
17
+ attr_accessor :threshold
18
+
19
+ attr_accessor :query_parameters
20
+
21
+ attr_accessor :fallback_parameters
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :index_name => :indexName,
27
+ :model => :model,
28
+ :threshold => :threshold,
29
+ :query_parameters => :queryParameters,
30
+ :fallback_parameters => :fallbackParameters
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.types_mapping
36
+ {
37
+ :index_name => :"String",
38
+ :model => :"Model",
39
+ :threshold => :"Integer",
40
+ :query_parameters => :"MainInjectionQueryParameters",
41
+ :fallback_parameters => :"MainInjectionQueryParameters"
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new(
48
+ []
49
+ )
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ raise(
57
+ ArgumentError,
58
+ "The input argument (attributes) must be a hash in `Algolia::MainRecommend` initialize method"
59
+ )
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ raise(
66
+ ArgumentError,
67
+ "`#{k}` is not a valid attribute in `Algolia::MainRecommend`. Please check the name to make sure it's valid. List of attributes: " +
68
+ self.class.attribute_map.keys.inspect
69
+ )
70
+ end
71
+
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:index_name)
76
+ self.index_name = attributes[:index_name]
77
+ else
78
+ self.index_name = nil
79
+ end
80
+
81
+ if attributes.key?(:model)
82
+ self.model = attributes[:model]
83
+ else
84
+ self.model = nil
85
+ end
86
+
87
+ if attributes.key?(:threshold)
88
+ self.threshold = attributes[:threshold]
89
+ else
90
+ self.threshold = nil
91
+ end
92
+
93
+ if attributes.key?(:query_parameters)
94
+ self.query_parameters = attributes[:query_parameters]
95
+ end
96
+
97
+ if attributes.key?(:fallback_parameters)
98
+ self.fallback_parameters = attributes[:fallback_parameters]
99
+ end
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(other)
105
+ return true if self.equal?(other)
106
+ self.class == other.class &&
107
+ index_name == other.index_name &&
108
+ model == other.model &&
109
+ threshold == other.threshold &&
110
+ query_parameters == other.query_parameters &&
111
+ fallback_parameters == other.fallback_parameters
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(other)
117
+ self == other
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [index_name, model, threshold, query_parameters, fallback_parameters].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ transformed_hash = {}
133
+ types_mapping.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash[key.to_sym] = nil
136
+ elsif type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
141
+ _deserialize(::Regexp.last_match(1), v)
142
+ }
143
+ end
144
+ elsif !attributes[attribute_map[key]].nil?
145
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
146
+ end
147
+ end
148
+
149
+ new(transformed_hash)
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def self._deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ # model
190
+ else
191
+ # models (e.g. Pet) or oneOf
192
+ klass = Algolia::Composition.const_get(type)
193
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
194
+ .build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ def to_json(*_args)
211
+ to_hash.to_json
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to?(:to_hash)
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+ end
249
+ end
250
+ end
@@ -7,8 +7,8 @@ require "time"
7
7
 
8
8
  module Algolia
9
9
  module Composition
10
- class CompositionSourceSearch
11
- # Composition Main Index name.
10
+ class MainSearch
11
+ # Index to retrieve search results from.
12
12
  attr_accessor :index
13
13
 
14
14
  attr_accessor :params
@@ -42,7 +42,7 @@ module Algolia
42
42
  if (!attributes.is_a?(Hash))
43
43
  raise(
44
44
  ArgumentError,
45
- "The input argument (attributes) must be a hash in `Algolia::CompositionSourceSearch` initialize method"
45
+ "The input argument (attributes) must be a hash in `Algolia::MainSearch` initialize method"
46
46
  )
47
47
  end
48
48
 
@@ -51,7 +51,7 @@ module Algolia
51
51
  if (!self.class.attribute_map.key?(k.to_sym))
52
52
  raise(
53
53
  ArgumentError,
54
- "`#{k}` is not a valid attribute in `Algolia::CompositionSourceSearch`. Please check the name to make sure it's valid. List of attributes: " +
54
+ "`#{k}` is not a valid attribute in `Algolia::MainSearch`. Please check the name to make sure it's valid. List of attributes: " +
55
55
  self.class.attribute_map.keys.inspect
56
56
  )
57
57
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Composition
10
+ class Model
11
+ TRENDING_ITEMS = "trending-items".freeze
12
+
13
+ def self.all_vars
14
+ @all_vars ||= [TRENDING_ITEMS].freeze
15
+ end
16
+
17
+ # Builds the enum from string
18
+ # @param [String] The enum value in the form of the string
19
+ # @return [String] The enum value
20
+ def self.build_from_hash(value)
21
+ new.build_from_hash(value)
22
+ end
23
+
24
+ # Builds the enum from string
25
+ # @param [String] The enum value in the form of the string
26
+ # @return [String] The enum value
27
+ def build_from_hash(value)
28
+ return value if Model.all_vars.include?(value)
29
+ raise "Invalid ENUM value #{value} for class #Model"
30
+ end
31
+ end
32
+ end
33
+ end