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