algolia 3.0.0.beta.11 → 3.0.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +2 -2
- data/lib/algolia/api/query_suggestions_client.rb +4 -10
- data/lib/algolia/api/search_client.rb +2 -2
- data/lib/algolia/api/usage_client.rb +4 -4
- data/lib/algolia/models/abtesting/{filter_effects_empty_search.rb → empty_search_filter.rb} +3 -3
- data/lib/algolia/models/abtesting/filter_effects.rb +2 -2
- data/lib/algolia/models/abtesting/{filter_effects_outliers.rb → outliers_filter.rb} +3 -3
- data/lib/algolia/models/analytics/{click_positions_inner.rb → click_position.rb} +3 -3
- data/lib/algolia/models/analytics/get_click_positions_response.rb +1 -1
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
- data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +1 -1
- data/lib/algolia/models/ingestion/docker_streams_input.rb +1 -0
- data/lib/algolia/models/ingestion/{transformation_try_response_error.rb → transformation_error.rb} +3 -3
- data/lib/algolia/models/ingestion/transformation_try_response.rb +1 -1
- data/lib/algolia/models/monitoring/{incidents_inner.rb → incident_entry.rb} +3 -3
- data/lib/algolia/models/monitoring/{indexing_time_response_metrics.rb → indexing_metric.rb} +3 -3
- data/lib/algolia/models/monitoring/indexing_time_response.rb +1 -1
- data/lib/algolia/models/monitoring/infrastructure_response.rb +1 -1
- data/lib/algolia/models/monitoring/{latency_response_metrics.rb → latency_metric.rb} +3 -3
- data/lib/algolia/models/monitoring/latency_response.rb +1 -1
- data/lib/algolia/models/monitoring/{infrastructure_response_metrics.rb → metrics.rb} +3 -6
- data/lib/algolia/models/monitoring/{time_inner.rb → time_entry.rb} +3 -3
- data/lib/algolia/models/{search/search_for_hits_options.rb → query-suggestions/config_status.rb} +43 -36
- data/lib/algolia/models/{recommend/related_products.rb → query-suggestions/log_file.rb} +36 -32
- data/lib/algolia/models/recommend/around_precision.rb +1 -1
- data/lib/algolia/models/recommend/fallback_params.rb +1 -1
- data/lib/algolia/models/recommend/{around_precision_from_value_inner.rb → range.rb} +3 -6
- data/lib/algolia/models/recommend/recommend_rule.rb +1 -1
- data/lib/algolia/models/recommend/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
- data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +1 -1
- data/lib/algolia/models/recommend/{recommend_rule_metadata.rb → rule_metadata.rb} +3 -3
- data/lib/algolia/models/recommend/search_params.rb +1 -1
- data/lib/algolia/models/recommend/search_params_object.rb +1 -1
- data/lib/algolia/models/search/around_precision.rb +1 -1
- data/lib/algolia/models/search/browse_params_object.rb +1 -1
- data/lib/algolia/models/search/built_in_operation.rb +1 -2
- data/lib/algolia/models/search/built_in_operation_value.rb +105 -0
- data/lib/algolia/models/search/consequence_params.rb +1 -1
- data/lib/algolia/models/search/dictionary_entry.rb +0 -2
- data/lib/algolia/models/search/index_settings.rb +2 -2
- data/lib/algolia/models/search/{around_precision_from_value_inner.rb → range.rb} +3 -6
- data/lib/algolia/models/search/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
- data/lib/algolia/models/search/redirect_rule_index_metadata.rb +1 -1
- data/lib/algolia/models/search/search_for_facets.rb +1 -1
- data/lib/algolia/models/search/search_for_hits.rb +1 -1
- data/lib/algolia/models/search/search_params_object.rb +1 -1
- data/lib/algolia/models/search/search_params_string.rb +1 -0
- data/lib/algolia/models/search/settings_response.rb +2 -2
- data/lib/algolia/models/usage/{get_usage400_response_error_errors_inner.rb → error_item.rb} +3 -3
- data/lib/algolia/models/usage/{get_usage400_response_error.rb → forbidden_error.rb} +4 -4
- data/lib/algolia/models/usage/{get_usage200_response.rb → index_usage.rb} +4 -4
- data/lib/algolia/models/usage/invalid_request_error.rb +231 -0
- data/lib/algolia/models/usage/{get_usage200_response_statistics_inner.rb → statistic_entry.rb} +3 -3
- data/lib/algolia/version.rb +1 -1
- metadata +24 -64
- data/lib/algolia/models/abtesting/custom_search_params.rb +0 -214
- data/lib/algolia/models/abtesting/error_base.rb +0 -212
- data/lib/algolia/models/analytics/error_base.rb +0 -212
- data/lib/algolia/models/ingestion/error_base.rb +0 -212
- data/lib/algolia/models/ingestion/source_shopify_base.rb +0 -214
- data/lib/algolia/models/insights/error_base.rb +0 -212
- data/lib/algolia/models/monitoring/error_base.rb +0 -212
- data/lib/algolia/models/monitoring/get_servers403_response.rb +0 -211
- data/lib/algolia/models/personalization/error_base.rb +0 -212
- data/lib/algolia/models/query-suggestions/app_id.rb +0 -209
- data/lib/algolia/models/query-suggestions/error_base.rb +0 -212
- data/lib/algolia/models/recommend/base_recommend_request.rb +0 -281
- data/lib/algolia/models/recommend/base_search_params.rb +0 -635
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +0 -616
- data/lib/algolia/models/recommend/base_search_response.rb +0 -499
- data/lib/algolia/models/recommend/error_base.rb +0 -212
- data/lib/algolia/models/recommend/frequently_bought_together.rb +0 -247
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +0 -788
- data/lib/algolia/models/recommend/looking_similar.rb +0 -256
- data/lib/algolia/models/recommend/recommendations_hits.rb +0 -215
- data/lib/algolia/models/recommend/recommended_for_you.rb +0 -244
- data/lib/algolia/models/recommend/search_pagination.rb +0 -282
- data/lib/algolia/models/recommend/search_params_query.rb +0 -212
- data/lib/algolia/models/recommend/trending_facets.rb +0 -258
- data/lib/algolia/models/recommend/trending_items.rb +0 -264
- data/lib/algolia/models/search/base_get_api_key_response.rb +0 -224
- data/lib/algolia/models/search/base_index_settings.rb +0 -426
- data/lib/algolia/models/search/base_search_params.rb +0 -635
- data/lib/algolia/models/search/base_search_params_without_query.rb +0 -616
- data/lib/algolia/models/search/base_search_response.rb +0 -499
- data/lib/algolia/models/search/browse_pagination.rb +0 -274
- data/lib/algolia/models/search/cursor.rb +0 -209
- data/lib/algolia/models/search/error_base.rb +0 -212
- data/lib/algolia/models/search/index_settings_as_search_params.rb +0 -788
- data/lib/algolia/models/search/params.rb +0 -236
- data/lib/algolia/models/search/search_for_facets_options.rb +0 -293
- data/lib/algolia/models/search/search_hits.rb +0 -240
- data/lib/algolia/models/search/search_pagination.rb +0 -282
- data/lib/algolia/models/search/search_params_query.rb +0 -212
- data/lib/algolia/models/search/with_primary.rb +0 -212
- data/lib/algolia/models/usage/error_base.rb +0 -212
- data/lib/algolia/models/usage/get_usage400_response.rb +0 -213
@@ -1,256 +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 LookingSimilar
|
9
|
-
attr_accessor :model
|
10
|
-
|
11
|
-
# Unique record identifier.
|
12
|
-
attr_accessor :object_id
|
13
|
-
|
14
|
-
attr_accessor :fallback_parameters
|
15
|
-
|
16
|
-
class EnumAttributeValidator
|
17
|
-
attr_reader :datatype
|
18
|
-
attr_reader :allowable_values
|
19
|
-
|
20
|
-
def initialize(datatype, allowable_values)
|
21
|
-
@allowable_values = allowable_values.map do |value|
|
22
|
-
case datatype.to_s
|
23
|
-
when /Integer/i
|
24
|
-
value.to_i
|
25
|
-
when /Float/i
|
26
|
-
value.to_f
|
27
|
-
else
|
28
|
-
value
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def valid?(value)
|
34
|
-
!value || allowable_values.include?(value)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
-
def self.attribute_map
|
40
|
-
{
|
41
|
-
:model => :model,
|
42
|
-
:object_id => :objectID,
|
43
|
-
:fallback_parameters => :fallbackParameters
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
# Returns all the JSON keys this model knows about
|
48
|
-
def self.acceptable_attributes
|
49
|
-
attribute_map.values
|
50
|
-
end
|
51
|
-
|
52
|
-
# Attribute type mapping.
|
53
|
-
def self.types_mapping
|
54
|
-
{
|
55
|
-
:model => :"LookingSimilarModel",
|
56
|
-
:object_id => :"String",
|
57
|
-
:fallback_parameters => :"FallbackParams"
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
# List of attributes with nullable: true
|
62
|
-
def self.openapi_nullable
|
63
|
-
Set.new(
|
64
|
-
[]
|
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::LookingSimilar` 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::LookingSimilar`. 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?(:model)
|
92
|
-
self.model = attributes[:model]
|
93
|
-
else
|
94
|
-
self.model = nil
|
95
|
-
end
|
96
|
-
|
97
|
-
if attributes.key?(:object_id)
|
98
|
-
self.object_id = attributes[:object_id]
|
99
|
-
else
|
100
|
-
self.object_id = nil
|
101
|
-
end
|
102
|
-
|
103
|
-
if attributes.key?(:fallback_parameters)
|
104
|
-
self.fallback_parameters = attributes[:fallback_parameters]
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Checks equality by comparing each attribute.
|
109
|
-
# @param [Object] Object to be compared
|
110
|
-
def ==(other)
|
111
|
-
return true if self.equal?(other)
|
112
|
-
self.class == other.class &&
|
113
|
-
model == other.model &&
|
114
|
-
object_id == other.object_id &&
|
115
|
-
fallback_parameters == other.fallback_parameters
|
116
|
-
end
|
117
|
-
|
118
|
-
# @see the `==` method
|
119
|
-
# @param [Object] Object to be compared
|
120
|
-
def eql?(other)
|
121
|
-
self == other
|
122
|
-
end
|
123
|
-
|
124
|
-
# Calculates hash code according to all attributes.
|
125
|
-
# @return [Integer] Hash code
|
126
|
-
def hash
|
127
|
-
[model, object_id, fallback_parameters].hash
|
128
|
-
end
|
129
|
-
|
130
|
-
# Builds the object from hash
|
131
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
132
|
-
# @return [Object] Returns the model itself
|
133
|
-
def self.build_from_hash(attributes)
|
134
|
-
return nil unless attributes.is_a?(Hash)
|
135
|
-
attributes = attributes.transform_keys(&:to_sym)
|
136
|
-
transformed_hash = {}
|
137
|
-
types_mapping.each_pair do |key, type|
|
138
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
139
|
-
transformed_hash[key.to_sym] = nil
|
140
|
-
elsif type =~ /\AArray<(.*)>/i
|
141
|
-
# check to ensure the input is an array given that the attribute
|
142
|
-
# is documented as an array but the input is not
|
143
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
144
|
-
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
145
|
-
_deserialize(::Regexp.last_match(1), v)
|
146
|
-
}
|
147
|
-
end
|
148
|
-
elsif !attributes[attribute_map[key]].nil?
|
149
|
-
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
new(transformed_hash)
|
154
|
-
end
|
155
|
-
|
156
|
-
# Deserializes the data based on type
|
157
|
-
# @param string type Data type
|
158
|
-
# @param string value Value to be deserialized
|
159
|
-
# @return [Object] Deserialized data
|
160
|
-
def self._deserialize(type, value)
|
161
|
-
case type.to_sym
|
162
|
-
when :Time
|
163
|
-
Time.parse(value)
|
164
|
-
when :Date
|
165
|
-
Date.parse(value)
|
166
|
-
when :String
|
167
|
-
value.to_s
|
168
|
-
when :Integer
|
169
|
-
value.to_i
|
170
|
-
when :Float
|
171
|
-
value.to_f
|
172
|
-
when :Boolean
|
173
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
174
|
-
true
|
175
|
-
else
|
176
|
-
false
|
177
|
-
end
|
178
|
-
|
179
|
-
when :Object
|
180
|
-
# generic object (usually a Hash), return directly
|
181
|
-
value
|
182
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
183
|
-
inner_type = Regexp.last_match[:inner_type]
|
184
|
-
value.map { |v| _deserialize(inner_type, v) }
|
185
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
186
|
-
k_type = Regexp.last_match[:k_type]
|
187
|
-
v_type = Regexp.last_match[:v_type]
|
188
|
-
{}.tap do |hash|
|
189
|
-
value.each do |k, v|
|
190
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
# model
|
194
|
-
else
|
195
|
-
# models (e.g. Pet) or oneOf
|
196
|
-
klass = Algolia::Recommend.const_get(type)
|
197
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
198
|
-
.build_from_hash(value)
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
# Returns the string representation of the object
|
203
|
-
# @return [String] String presentation of the object
|
204
|
-
def to_s
|
205
|
-
to_hash.to_s
|
206
|
-
end
|
207
|
-
|
208
|
-
# to_body is an alias to to_hash (backward compatibility)
|
209
|
-
# @return [Hash] Returns the object in the form of hash
|
210
|
-
def to_body
|
211
|
-
to_hash
|
212
|
-
end
|
213
|
-
|
214
|
-
def to_json(*_args)
|
215
|
-
to_hash.to_json
|
216
|
-
end
|
217
|
-
|
218
|
-
# Returns the object in the form of hash
|
219
|
-
# @return [Hash] Returns the object in the form of hash
|
220
|
-
def to_hash
|
221
|
-
hash = {}
|
222
|
-
self.class.attribute_map.each_pair do |attr, param|
|
223
|
-
value = send(attr)
|
224
|
-
if value.nil?
|
225
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
-
end
|
228
|
-
|
229
|
-
hash[param] = _to_hash(value)
|
230
|
-
end
|
231
|
-
|
232
|
-
hash
|
233
|
-
end
|
234
|
-
|
235
|
-
# Outputs non-array value in the form of hash
|
236
|
-
# For object, use to_hash. Otherwise, just return the value
|
237
|
-
# @param [Object] value Any valid value
|
238
|
-
# @return [Hash] Returns the value in the form of hash
|
239
|
-
def _to_hash(value)
|
240
|
-
if value.is_a?(Array)
|
241
|
-
value.compact.map { |v| _to_hash(v) }
|
242
|
-
elsif value.is_a?(Hash)
|
243
|
-
{}.tap do |hash|
|
244
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
245
|
-
end
|
246
|
-
elsif value.respond_to?(:to_hash)
|
247
|
-
value.to_hash
|
248
|
-
else
|
249
|
-
value
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
end
|
254
|
-
|
255
|
-
end
|
256
|
-
end
|
@@ -1,215 +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 RecommendationsHits
|
9
|
-
attr_accessor :hits
|
10
|
-
|
11
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
12
|
-
def self.attribute_map
|
13
|
-
{
|
14
|
-
:hits => :hits
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
# Returns all the JSON keys this model knows about
|
19
|
-
def self.acceptable_attributes
|
20
|
-
attribute_map.values
|
21
|
-
end
|
22
|
-
|
23
|
-
# Attribute type mapping.
|
24
|
-
def self.types_mapping
|
25
|
-
{
|
26
|
-
:hits => :"Array<RecommendationsHit>"
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# List of attributes with nullable: true
|
31
|
-
def self.openapi_nullable
|
32
|
-
Set.new(
|
33
|
-
[]
|
34
|
-
)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Initializes the object
|
38
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
39
|
-
def initialize(attributes = {})
|
40
|
-
if (!attributes.is_a?(Hash))
|
41
|
-
raise(
|
42
|
-
ArgumentError,
|
43
|
-
"The input argument (attributes) must be a hash in `Algolia::RecommendationsHits` initialize method"
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
48
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
49
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
50
|
-
raise(
|
51
|
-
ArgumentError,
|
52
|
-
"`#{k}` is not a valid attribute in `Algolia::RecommendationsHits`. Please check the name to make sure it's valid. List of attributes: " +
|
53
|
-
self.class.attribute_map.keys.inspect
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:hits)
|
61
|
-
if (value = attributes[:hits]).is_a?(Array)
|
62
|
-
self.hits = value
|
63
|
-
end
|
64
|
-
else
|
65
|
-
self.hits = nil
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# Checks equality by comparing each attribute.
|
70
|
-
# @param [Object] Object to be compared
|
71
|
-
def ==(other)
|
72
|
-
return true if self.equal?(other)
|
73
|
-
self.class == other.class &&
|
74
|
-
hits == other.hits
|
75
|
-
end
|
76
|
-
|
77
|
-
# @see the `==` method
|
78
|
-
# @param [Object] Object to be compared
|
79
|
-
def eql?(other)
|
80
|
-
self == other
|
81
|
-
end
|
82
|
-
|
83
|
-
# Calculates hash code according to all attributes.
|
84
|
-
# @return [Integer] Hash code
|
85
|
-
def hash
|
86
|
-
[hits].hash
|
87
|
-
end
|
88
|
-
|
89
|
-
# Builds the object from hash
|
90
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
-
# @return [Object] Returns the model itself
|
92
|
-
def self.build_from_hash(attributes)
|
93
|
-
return nil unless attributes.is_a?(Hash)
|
94
|
-
attributes = attributes.transform_keys(&:to_sym)
|
95
|
-
transformed_hash = {}
|
96
|
-
types_mapping.each_pair do |key, type|
|
97
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
98
|
-
transformed_hash[key.to_sym] = nil
|
99
|
-
elsif type =~ /\AArray<(.*)>/i
|
100
|
-
# check to ensure the input is an array given that the attribute
|
101
|
-
# is documented as an array but the input is not
|
102
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
103
|
-
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
104
|
-
_deserialize(::Regexp.last_match(1), v)
|
105
|
-
}
|
106
|
-
end
|
107
|
-
elsif !attributes[attribute_map[key]].nil?
|
108
|
-
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
new(transformed_hash)
|
113
|
-
end
|
114
|
-
|
115
|
-
# Deserializes the data based on type
|
116
|
-
# @param string type Data type
|
117
|
-
# @param string value Value to be deserialized
|
118
|
-
# @return [Object] Deserialized data
|
119
|
-
def self._deserialize(type, value)
|
120
|
-
case type.to_sym
|
121
|
-
when :Time
|
122
|
-
Time.parse(value)
|
123
|
-
when :Date
|
124
|
-
Date.parse(value)
|
125
|
-
when :String
|
126
|
-
value.to_s
|
127
|
-
when :Integer
|
128
|
-
value.to_i
|
129
|
-
when :Float
|
130
|
-
value.to_f
|
131
|
-
when :Boolean
|
132
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
133
|
-
true
|
134
|
-
else
|
135
|
-
false
|
136
|
-
end
|
137
|
-
|
138
|
-
when :Object
|
139
|
-
# generic object (usually a Hash), return directly
|
140
|
-
value
|
141
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
142
|
-
inner_type = Regexp.last_match[:inner_type]
|
143
|
-
value.map { |v| _deserialize(inner_type, v) }
|
144
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
145
|
-
k_type = Regexp.last_match[:k_type]
|
146
|
-
v_type = Regexp.last_match[:v_type]
|
147
|
-
{}.tap do |hash|
|
148
|
-
value.each do |k, v|
|
149
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
# model
|
153
|
-
else
|
154
|
-
# models (e.g. Pet) or oneOf
|
155
|
-
klass = Algolia::Recommend.const_get(type)
|
156
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
157
|
-
.build_from_hash(value)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
# Returns the string representation of the object
|
162
|
-
# @return [String] String presentation of the object
|
163
|
-
def to_s
|
164
|
-
to_hash.to_s
|
165
|
-
end
|
166
|
-
|
167
|
-
# to_body is an alias to to_hash (backward compatibility)
|
168
|
-
# @return [Hash] Returns the object in the form of hash
|
169
|
-
def to_body
|
170
|
-
to_hash
|
171
|
-
end
|
172
|
-
|
173
|
-
def to_json(*_args)
|
174
|
-
to_hash.to_json
|
175
|
-
end
|
176
|
-
|
177
|
-
# Returns the object in the form of hash
|
178
|
-
# @return [Hash] Returns the object in the form of hash
|
179
|
-
def to_hash
|
180
|
-
hash = {}
|
181
|
-
self.class.attribute_map.each_pair do |attr, param|
|
182
|
-
value = send(attr)
|
183
|
-
if value.nil?
|
184
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
185
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
186
|
-
end
|
187
|
-
|
188
|
-
hash[param] = _to_hash(value)
|
189
|
-
end
|
190
|
-
|
191
|
-
hash
|
192
|
-
end
|
193
|
-
|
194
|
-
# Outputs non-array value in the form of hash
|
195
|
-
# For object, use to_hash. Otherwise, just return the value
|
196
|
-
# @param [Object] value Any valid value
|
197
|
-
# @return [Hash] Returns the value in the form of hash
|
198
|
-
def _to_hash(value)
|
199
|
-
if value.is_a?(Array)
|
200
|
-
value.compact.map { |v| _to_hash(v) }
|
201
|
-
elsif value.is_a?(Hash)
|
202
|
-
{}.tap do |hash|
|
203
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
-
end
|
205
|
-
elsif value.respond_to?(:to_hash)
|
206
|
-
value.to_hash
|
207
|
-
else
|
208
|
-
value
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
end
|
213
|
-
|
214
|
-
end
|
215
|
-
end
|
@@ -1,244 +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 RecommendedForYou
|
9
|
-
attr_accessor :model
|
10
|
-
|
11
|
-
attr_accessor :fallback_parameters
|
12
|
-
|
13
|
-
class EnumAttributeValidator
|
14
|
-
attr_reader :datatype
|
15
|
-
attr_reader :allowable_values
|
16
|
-
|
17
|
-
def initialize(datatype, allowable_values)
|
18
|
-
@allowable_values = allowable_values.map do |value|
|
19
|
-
case datatype.to_s
|
20
|
-
when /Integer/i
|
21
|
-
value.to_i
|
22
|
-
when /Float/i
|
23
|
-
value.to_f
|
24
|
-
else
|
25
|
-
value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def valid?(value)
|
31
|
-
!value || allowable_values.include?(value)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
-
def self.attribute_map
|
37
|
-
{
|
38
|
-
:model => :model,
|
39
|
-
:fallback_parameters => :fallbackParameters
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns all the JSON keys this model knows about
|
44
|
-
def self.acceptable_attributes
|
45
|
-
attribute_map.values
|
46
|
-
end
|
47
|
-
|
48
|
-
# Attribute type mapping.
|
49
|
-
def self.types_mapping
|
50
|
-
{
|
51
|
-
:model => :"RecommendedForYouModel",
|
52
|
-
:fallback_parameters => :"FallbackParams"
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
|
-
# List of attributes with nullable: true
|
57
|
-
def self.openapi_nullable
|
58
|
-
Set.new(
|
59
|
-
[]
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Initializes the object
|
64
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
-
def initialize(attributes = {})
|
66
|
-
if (!attributes.is_a?(Hash))
|
67
|
-
raise(
|
68
|
-
ArgumentError,
|
69
|
-
"The input argument (attributes) must be a hash in `Algolia::RecommendedForYou` initialize method"
|
70
|
-
)
|
71
|
-
end
|
72
|
-
|
73
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
-
raise(
|
77
|
-
ArgumentError,
|
78
|
-
"`#{k}` is not a valid attribute in `Algolia::RecommendedForYou`. Please check the name to make sure it's valid. List of attributes: " +
|
79
|
-
self.class.attribute_map.keys.inspect
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
h[k.to_sym] = v
|
84
|
-
}
|
85
|
-
|
86
|
-
if attributes.key?(:model)
|
87
|
-
self.model = attributes[:model]
|
88
|
-
else
|
89
|
-
self.model = nil
|
90
|
-
end
|
91
|
-
|
92
|
-
if attributes.key?(:fallback_parameters)
|
93
|
-
self.fallback_parameters = attributes[:fallback_parameters]
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Checks equality by comparing each attribute.
|
98
|
-
# @param [Object] Object to be compared
|
99
|
-
def ==(other)
|
100
|
-
return true if self.equal?(other)
|
101
|
-
self.class == other.class &&
|
102
|
-
model == other.model &&
|
103
|
-
fallback_parameters == other.fallback_parameters
|
104
|
-
end
|
105
|
-
|
106
|
-
# @see the `==` method
|
107
|
-
# @param [Object] Object to be compared
|
108
|
-
def eql?(other)
|
109
|
-
self == other
|
110
|
-
end
|
111
|
-
|
112
|
-
# Calculates hash code according to all attributes.
|
113
|
-
# @return [Integer] Hash code
|
114
|
-
def hash
|
115
|
-
[model, fallback_parameters].hash
|
116
|
-
end
|
117
|
-
|
118
|
-
# Builds the object from hash
|
119
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
-
# @return [Object] Returns the model itself
|
121
|
-
def self.build_from_hash(attributes)
|
122
|
-
return nil unless attributes.is_a?(Hash)
|
123
|
-
attributes = attributes.transform_keys(&:to_sym)
|
124
|
-
transformed_hash = {}
|
125
|
-
types_mapping.each_pair do |key, type|
|
126
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
127
|
-
transformed_hash[key.to_sym] = nil
|
128
|
-
elsif type =~ /\AArray<(.*)>/i
|
129
|
-
# check to ensure the input is an array given that the attribute
|
130
|
-
# is documented as an array but the input is not
|
131
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
132
|
-
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
133
|
-
_deserialize(::Regexp.last_match(1), v)
|
134
|
-
}
|
135
|
-
end
|
136
|
-
elsif !attributes[attribute_map[key]].nil?
|
137
|
-
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
new(transformed_hash)
|
142
|
-
end
|
143
|
-
|
144
|
-
# Deserializes the data based on type
|
145
|
-
# @param string type Data type
|
146
|
-
# @param string value Value to be deserialized
|
147
|
-
# @return [Object] Deserialized data
|
148
|
-
def self._deserialize(type, value)
|
149
|
-
case type.to_sym
|
150
|
-
when :Time
|
151
|
-
Time.parse(value)
|
152
|
-
when :Date
|
153
|
-
Date.parse(value)
|
154
|
-
when :String
|
155
|
-
value.to_s
|
156
|
-
when :Integer
|
157
|
-
value.to_i
|
158
|
-
when :Float
|
159
|
-
value.to_f
|
160
|
-
when :Boolean
|
161
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
-
true
|
163
|
-
else
|
164
|
-
false
|
165
|
-
end
|
166
|
-
|
167
|
-
when :Object
|
168
|
-
# generic object (usually a Hash), return directly
|
169
|
-
value
|
170
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
171
|
-
inner_type = Regexp.last_match[:inner_type]
|
172
|
-
value.map { |v| _deserialize(inner_type, v) }
|
173
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
174
|
-
k_type = Regexp.last_match[:k_type]
|
175
|
-
v_type = Regexp.last_match[:v_type]
|
176
|
-
{}.tap do |hash|
|
177
|
-
value.each do |k, v|
|
178
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
# model
|
182
|
-
else
|
183
|
-
# models (e.g. Pet) or oneOf
|
184
|
-
klass = Algolia::Recommend.const_get(type)
|
185
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
186
|
-
.build_from_hash(value)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
# Returns the string representation of the object
|
191
|
-
# @return [String] String presentation of the object
|
192
|
-
def to_s
|
193
|
-
to_hash.to_s
|
194
|
-
end
|
195
|
-
|
196
|
-
# to_body is an alias to to_hash (backward compatibility)
|
197
|
-
# @return [Hash] Returns the object in the form of hash
|
198
|
-
def to_body
|
199
|
-
to_hash
|
200
|
-
end
|
201
|
-
|
202
|
-
def to_json(*_args)
|
203
|
-
to_hash.to_json
|
204
|
-
end
|
205
|
-
|
206
|
-
# Returns the object in the form of hash
|
207
|
-
# @return [Hash] Returns the object in the form of hash
|
208
|
-
def to_hash
|
209
|
-
hash = {}
|
210
|
-
self.class.attribute_map.each_pair do |attr, param|
|
211
|
-
value = send(attr)
|
212
|
-
if value.nil?
|
213
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
214
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
215
|
-
end
|
216
|
-
|
217
|
-
hash[param] = _to_hash(value)
|
218
|
-
end
|
219
|
-
|
220
|
-
hash
|
221
|
-
end
|
222
|
-
|
223
|
-
# Outputs non-array value in the form of hash
|
224
|
-
# For object, use to_hash. Otherwise, just return the value
|
225
|
-
# @param [Object] value Any valid value
|
226
|
-
# @return [Hash] Returns the value in the form of hash
|
227
|
-
def _to_hash(value)
|
228
|
-
if value.is_a?(Array)
|
229
|
-
value.compact.map { |v| _to_hash(v) }
|
230
|
-
elsif value.is_a?(Hash)
|
231
|
-
{}.tap do |hash|
|
232
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
233
|
-
end
|
234
|
-
elsif value.respond_to?(:to_hash)
|
235
|
-
value.to_hash
|
236
|
-
else
|
237
|
-
value
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
end
|
242
|
-
|
243
|
-
end
|
244
|
-
end
|