algolia 3.8.0 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/search_client.rb +2 -2
- data/lib/algolia/models/recommend/fallback_params.rb +19 -22
- data/lib/algolia/models/recommend/inside_bounding_box.rb +108 -0
- data/lib/algolia/models/recommend/optional_words.rb +108 -0
- data/lib/algolia/models/recommend/recommend_search_params.rb +19 -22
- data/lib/algolia/models/recommend/recommendations_request.rb +0 -1
- data/lib/algolia/models/search/browse_params_object.rb +8 -22
- data/lib/algolia/models/search/consequence_params.rb +8 -22
- data/lib/algolia/models/search/delete_by_params.rb +5 -6
- data/lib/algolia/models/search/index_settings.rb +16 -17
- data/lib/algolia/models/search/inside_bounding_box.rb +108 -0
- data/lib/algolia/models/search/optional_words.rb +108 -0
- data/lib/algolia/models/search/search_for_facets.rb +19 -22
- data/lib/algolia/models/search/search_for_hits.rb +8 -22
- data/lib/algolia/models/search/search_params_object.rb +8 -22
- data/lib/algolia/models/search/settings_response.rb +16 -17
- data/lib/algolia/version.rb +1 -1
- metadata +6 -4
- data/lib/algolia/models/recommend/recommended_for_you_model.rb +0 -31
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +0 -273
@@ -1,273 +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 Recommend
|
8
|
-
class RecommendedForYouQuery
|
9
|
-
# Index name (case-sensitive).
|
10
|
-
attr_accessor :index_name
|
11
|
-
|
12
|
-
# Minimum score a recommendation must have to be included in the response.
|
13
|
-
attr_accessor :threshold
|
14
|
-
|
15
|
-
# Maximum number of recommendations to retrieve. By default, all recommendations are returned and no fallback request is made. Depending on the available recommendations and the other request parameters, the actual number of recommendations may be lower than this value.
|
16
|
-
attr_accessor :max_recommendations
|
17
|
-
|
18
|
-
attr_accessor :query_parameters
|
19
|
-
|
20
|
-
attr_accessor :model
|
21
|
-
|
22
|
-
attr_accessor :fallback_parameters
|
23
|
-
|
24
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
-
def self.attribute_map
|
26
|
-
{
|
27
|
-
:index_name => :indexName,
|
28
|
-
:threshold => :threshold,
|
29
|
-
:max_recommendations => :maxRecommendations,
|
30
|
-
:query_parameters => :queryParameters,
|
31
|
-
:model => :model,
|
32
|
-
:fallback_parameters => :fallbackParameters
|
33
|
-
}
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns all the JSON keys this model knows about
|
37
|
-
def self.acceptable_attributes
|
38
|
-
attribute_map.values
|
39
|
-
end
|
40
|
-
|
41
|
-
# Attribute type mapping.
|
42
|
-
def self.types_mapping
|
43
|
-
{
|
44
|
-
:index_name => :"String",
|
45
|
-
:threshold => :"Float",
|
46
|
-
:max_recommendations => :"Integer",
|
47
|
-
:query_parameters => :"RecommendSearchParams",
|
48
|
-
:model => :"RecommendedForYouModel",
|
49
|
-
:fallback_parameters => :"FallbackParams"
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
# List of attributes with nullable: true
|
54
|
-
def self.openapi_nullable
|
55
|
-
Set.new(
|
56
|
-
[]
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
# List of class defined in allOf (OpenAPI v3)
|
61
|
-
def self.openapi_all_of
|
62
|
-
[
|
63
|
-
:"BaseRecommendRequest",
|
64
|
-
:"RecommendedForYou"
|
65
|
-
]
|
66
|
-
end
|
67
|
-
|
68
|
-
# Initializes the object
|
69
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
70
|
-
def initialize(attributes = {})
|
71
|
-
if (!attributes.is_a?(Hash))
|
72
|
-
raise(
|
73
|
-
ArgumentError,
|
74
|
-
"The input argument (attributes) must be a hash in `Algolia::RecommendedForYouQuery` initialize method"
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
-
raise(
|
82
|
-
ArgumentError,
|
83
|
-
"`#{k}` is not a valid attribute in `Algolia::RecommendedForYouQuery`. Please check the name to make sure it's valid. List of attributes: " +
|
84
|
-
self.class.attribute_map.keys.inspect
|
85
|
-
)
|
86
|
-
end
|
87
|
-
|
88
|
-
h[k.to_sym] = v
|
89
|
-
}
|
90
|
-
|
91
|
-
if attributes.key?(:index_name)
|
92
|
-
self.index_name = attributes[:index_name]
|
93
|
-
else
|
94
|
-
self.index_name = nil
|
95
|
-
end
|
96
|
-
|
97
|
-
if attributes.key?(:threshold)
|
98
|
-
self.threshold = attributes[:threshold]
|
99
|
-
else
|
100
|
-
self.threshold = nil
|
101
|
-
end
|
102
|
-
|
103
|
-
if attributes.key?(:max_recommendations)
|
104
|
-
self.max_recommendations = attributes[:max_recommendations]
|
105
|
-
end
|
106
|
-
|
107
|
-
if attributes.key?(:query_parameters)
|
108
|
-
self.query_parameters = attributes[:query_parameters]
|
109
|
-
end
|
110
|
-
|
111
|
-
if attributes.key?(:model)
|
112
|
-
self.model = attributes[:model]
|
113
|
-
else
|
114
|
-
self.model = nil
|
115
|
-
end
|
116
|
-
|
117
|
-
if attributes.key?(:fallback_parameters)
|
118
|
-
self.fallback_parameters = attributes[:fallback_parameters]
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
# Checks equality by comparing each attribute.
|
123
|
-
# @param [Object] Object to be compared
|
124
|
-
def ==(other)
|
125
|
-
return true if self.equal?(other)
|
126
|
-
self.class == other.class &&
|
127
|
-
index_name == other.index_name &&
|
128
|
-
threshold == other.threshold &&
|
129
|
-
max_recommendations == other.max_recommendations &&
|
130
|
-
query_parameters == other.query_parameters &&
|
131
|
-
model == other.model &&
|
132
|
-
fallback_parameters == other.fallback_parameters
|
133
|
-
end
|
134
|
-
|
135
|
-
# @see the `==` method
|
136
|
-
# @param [Object] Object to be compared
|
137
|
-
def eql?(other)
|
138
|
-
self == other
|
139
|
-
end
|
140
|
-
|
141
|
-
# Calculates hash code according to all attributes.
|
142
|
-
# @return [Integer] Hash code
|
143
|
-
def hash
|
144
|
-
[index_name, threshold, max_recommendations, query_parameters, model, fallback_parameters].hash
|
145
|
-
end
|
146
|
-
|
147
|
-
# Builds the object from hash
|
148
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
-
# @return [Object] Returns the model itself
|
150
|
-
def self.build_from_hash(attributes)
|
151
|
-
return nil unless attributes.is_a?(Hash)
|
152
|
-
attributes = attributes.transform_keys(&:to_sym)
|
153
|
-
transformed_hash = {}
|
154
|
-
types_mapping.each_pair do |key, type|
|
155
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
156
|
-
transformed_hash[key.to_sym] = nil
|
157
|
-
elsif type =~ /\AArray<(.*)>/i
|
158
|
-
# check to ensure the input is an array given that the attribute
|
159
|
-
# is documented as an array but the input is not
|
160
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
161
|
-
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
162
|
-
_deserialize(::Regexp.last_match(1), v)
|
163
|
-
}
|
164
|
-
end
|
165
|
-
elsif !attributes[attribute_map[key]].nil?
|
166
|
-
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
new(transformed_hash)
|
171
|
-
end
|
172
|
-
|
173
|
-
# Deserializes the data based on type
|
174
|
-
# @param string type Data type
|
175
|
-
# @param string value Value to be deserialized
|
176
|
-
# @return [Object] Deserialized data
|
177
|
-
def self._deserialize(type, value)
|
178
|
-
case type.to_sym
|
179
|
-
when :Time
|
180
|
-
Time.parse(value)
|
181
|
-
when :Date
|
182
|
-
Date.parse(value)
|
183
|
-
when :String
|
184
|
-
value.to_s
|
185
|
-
when :Integer
|
186
|
-
value.to_i
|
187
|
-
when :Float
|
188
|
-
value.to_f
|
189
|
-
when :Boolean
|
190
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
191
|
-
true
|
192
|
-
else
|
193
|
-
false
|
194
|
-
end
|
195
|
-
|
196
|
-
when :Object
|
197
|
-
# generic object (usually a Hash), return directly
|
198
|
-
value
|
199
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
-
inner_type = Regexp.last_match[:inner_type]
|
201
|
-
value.map { |v| _deserialize(inner_type, v) }
|
202
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
-
k_type = Regexp.last_match[:k_type]
|
204
|
-
v_type = Regexp.last_match[:v_type]
|
205
|
-
{}.tap do |hash|
|
206
|
-
value.each do |k, v|
|
207
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
# model
|
211
|
-
else
|
212
|
-
# models (e.g. Pet) or oneOf
|
213
|
-
klass = Algolia::Recommend.const_get(type)
|
214
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
215
|
-
.build_from_hash(value)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# Returns the string representation of the object
|
220
|
-
# @return [String] String presentation of the object
|
221
|
-
def to_s
|
222
|
-
to_hash.to_s
|
223
|
-
end
|
224
|
-
|
225
|
-
# to_body is an alias to to_hash (backward compatibility)
|
226
|
-
# @return [Hash] Returns the object in the form of hash
|
227
|
-
def to_body
|
228
|
-
to_hash
|
229
|
-
end
|
230
|
-
|
231
|
-
def to_json(*_args)
|
232
|
-
to_hash.to_json
|
233
|
-
end
|
234
|
-
|
235
|
-
# Returns the object in the form of hash
|
236
|
-
# @return [Hash] Returns the object in the form of hash
|
237
|
-
def to_hash
|
238
|
-
hash = {}
|
239
|
-
self.class.attribute_map.each_pair do |attr, param|
|
240
|
-
value = send(attr)
|
241
|
-
if value.nil?
|
242
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
243
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
244
|
-
end
|
245
|
-
|
246
|
-
hash[param] = _to_hash(value)
|
247
|
-
end
|
248
|
-
|
249
|
-
hash
|
250
|
-
end
|
251
|
-
|
252
|
-
# Outputs non-array value in the form of hash
|
253
|
-
# For object, use to_hash. Otherwise, just return the value
|
254
|
-
# @param [Object] value Any valid value
|
255
|
-
# @return [Hash] Returns the value in the form of hash
|
256
|
-
def _to_hash(value)
|
257
|
-
if value.is_a?(Array)
|
258
|
-
value.compact.map { |v| _to_hash(v) }
|
259
|
-
elsif value.is_a?(Hash)
|
260
|
-
{}.tap do |hash|
|
261
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
262
|
-
end
|
263
|
-
elsif value.respond_to?(:to_hash)
|
264
|
-
value.to_hash
|
265
|
-
else
|
266
|
-
value
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
end
|
271
|
-
|
272
|
-
end
|
273
|
-
end
|