algolia 3.5.0 → 3.5.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 +8 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/abtesting_client.rb +0 -7
- data/lib/algolia/api/analytics_client.rb +0 -168
- data/lib/algolia/api/ingestion_client.rb +2 -170
- data/lib/algolia/api/insights_client.rb +0 -22
- data/lib/algolia/api/monitoring_client.rb +11 -11
- data/lib/algolia/api/search_client.rb +3 -58
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +0 -18
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +0 -18
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +0 -18
- data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +0 -18
- data/lib/algolia/models/abtesting/schedule_ab_tests_request.rb +0 -18
- data/lib/algolia/models/abtesting/variant.rb +0 -18
- data/lib/algolia/models/analytics/click_position.rb +0 -32
- data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +0 -28
- data/lib/algolia/models/analytics/daily_average_clicks.rb +0 -24
- data/lib/algolia/models/analytics/daily_click_through_rates.rb +0 -28
- data/lib/algolia/models/analytics/daily_conversion_rates.rb +0 -28
- data/lib/algolia/models/analytics/daily_no_click_rates.rb +0 -32
- data/lib/algolia/models/analytics/daily_no_results_rates.rb +0 -18
- data/lib/algolia/models/analytics/daily_purchase_rates.rb +0 -14
- data/lib/algolia/models/analytics/daily_searches_no_clicks.rb +0 -14
- data/lib/algolia/models/analytics/daily_searches_no_results.rb +0 -14
- data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +0 -28
- data/lib/algolia/models/analytics/get_average_click_position_response.rb +0 -24
- data/lib/algolia/models/analytics/get_click_positions_response.rb +0 -18
- data/lib/algolia/models/analytics/get_click_through_rate_response.rb +0 -28
- data/lib/algolia/models/analytics/get_conversion_rate_response.rb +0 -28
- data/lib/algolia/models/analytics/get_no_click_rate_response.rb +0 -32
- data/lib/algolia/models/analytics/get_no_results_rate_response.rb +0 -18
- data/lib/algolia/models/analytics/get_purchase_rate_response.rb +0 -14
- data/lib/algolia/models/analytics/top_hit_with_analytics.rb +0 -56
- data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +0 -98
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +0 -90
- data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +0 -132
- data/lib/algolia/models/ingestion/event.rb +0 -14
- data/lib/algolia/models/ingestion/pagination.rb +0 -60
- data/lib/algolia/models/ingestion/run.rb +0 -18
- data/lib/algolia/models/ingestion/source_csv.rb +0 -21
- data/lib/algolia/models/ingestion/task.rb +0 -18
- data/lib/algolia/models/ingestion/task_create.rb +0 -18
- data/lib/algolia/models/ingestion/task_create_v1.rb +0 -18
- data/lib/algolia/models/ingestion/task_update.rb +0 -18
- data/lib/algolia/models/ingestion/task_update_v1.rb +0 -18
- data/lib/algolia/models/ingestion/task_v1.rb +0 -18
- data/lib/algolia/models/ingestion/transformation.rb +1 -1
- data/lib/algolia/models/ingestion/transformation_create.rb +1 -1
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +0 -123
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +0 -149
- data/lib/algolia/models/insights/clicked_filters.rb +0 -105
- data/lib/algolia/models/insights/clicked_object_ids.rb +0 -105
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +0 -149
- data/lib/algolia/models/insights/converted_filters.rb +0 -105
- data/lib/algolia/models/insights/converted_object_ids.rb +0 -105
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +0 -131
- data/lib/algolia/models/insights/insights_events.rb +0 -18
- data/lib/algolia/models/insights/object_data_after_search.rb +0 -26
- data/lib/algolia/models/insights/purchased_object_ids.rb +0 -123
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +0 -123
- data/lib/algolia/models/insights/viewed_filters.rb +0 -105
- data/lib/algolia/models/insights/viewed_object_ids.rb +0 -105
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +0 -18
- data/lib/algolia/models/query-suggestions/configuration.rb +0 -17
- data/lib/algolia/models/query-suggestions/configuration_response.rb +0 -17
- data/lib/algolia/models/query-suggestions/configuration_with_index.rb +0 -17
- data/lib/algolia/models/query-suggestions/source_index.rb +0 -28
- data/lib/algolia/models/recommend/banner_image.rb +4 -2
- data/lib/algolia/models/recommend/bought_together_query.rb +0 -36
- data/lib/algolia/models/recommend/condition.rb +0 -15
- data/lib/algolia/models/recommend/consequence.rb +0 -28
- data/lib/algolia/models/recommend/fallback_params.rb +0 -92
- data/lib/algolia/models/recommend/looking_similar_query.rb +0 -36
- data/lib/algolia/models/recommend/promote_consequence_object.rb +0 -14
- data/lib/algolia/models/recommend/ranking_info.rb +0 -112
- data/lib/algolia/models/recommend/recommend_hit.rb +0 -18
- data/lib/algolia/models/recommend/recommend_search_params.rb +0 -92
- data/lib/algolia/models/recommend/recommendations_results.rb +0 -61
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +0 -36
- data/lib/algolia/models/recommend/related_query.rb +0 -36
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +0 -50
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +0 -14
- data/lib/algolia/models/recommend/trending_facet_hit.rb +0 -18
- data/lib/algolia/models/recommend/trending_facets_query.rb +0 -36
- data/lib/algolia/models/recommend/trending_items_query.rb +0 -36
- data/lib/algolia/models/recommend/widgets.rb +5 -2
- data/lib/algolia/models/search/banner_image.rb +4 -2
- data/lib/algolia/models/search/browse_params_object.rb +0 -128
- data/lib/algolia/models/search/browse_response.rb +0 -61
- data/lib/algolia/models/search/condition.rb +0 -15
- data/lib/algolia/models/search/consequence.rb +0 -28
- data/lib/algolia/models/search/consequence_params.rb +0 -128
- data/lib/algolia/models/search/index_settings.rb +0 -78
- data/lib/algolia/models/search/log.rb +0 -34
- data/lib/algolia/models/search/promote_object_ids.rb +0 -14
- data/lib/algolia/models/search/ranking_info.rb +0 -112
- data/lib/algolia/models/search/rule.rb +0 -18
- data/lib/algolia/models/search/search_dictionary_entries_params.rb +0 -32
- data/lib/algolia/models/search/search_dictionary_entries_response.rb +0 -14
- data/lib/algolia/models/search/search_for_facet_values_request.rb +0 -14
- data/lib/algolia/models/search/search_for_facets.rb +0 -128
- data/lib/algolia/models/search/search_for_hits.rb +0 -128
- data/lib/algolia/models/search/search_params_object.rb +0 -128
- data/lib/algolia/models/search/search_response.rb +0 -61
- data/lib/algolia/models/search/search_rules_params.rb +0 -32
- data/lib/algolia/models/search/search_synonyms_params.rb +0 -32
- data/lib/algolia/models/search/search_user_ids_params.rb +0 -32
- data/lib/algolia/models/search/search_user_ids_response.rb +0 -32
- data/lib/algolia/models/search/settings_response.rb +0 -78
- data/lib/algolia/models/search/user_hit.rb +0 -15
- data/lib/algolia/models/search/user_id.rb +0 -15
- data/lib/algolia/models/search/widgets.rb +5 -2
- data/lib/algolia/version.rb +1 -1
- metadata +2 -11
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +0 -230
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +0 -212
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +0 -252
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +0 -263
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +0 -276
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +0 -316
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +0 -295
- data/lib/algolia/models/recommend/banners.rb +0 -209
- data/lib/algolia/models/search/banners.rb +0 -209
@@ -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 Recommend
|
8
|
-
# banners defined in the merchandising studio for the given search.
|
9
|
-
class Banners
|
10
|
-
attr_accessor :banners
|
11
|
-
|
12
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
-
def self.attribute_map
|
14
|
-
{
|
15
|
-
:banners => :banners
|
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
|
-
:banners => :"Banner"
|
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::Banners` 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::Banners`. 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?(:banners)
|
59
|
-
self.banners = attributes[:banners]
|
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
|
-
banners == other.banners
|
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
|
-
[banners].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::Recommend.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,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
|
-
# banners defined in the merchandising studio for the given search.
|
9
|
-
class Banners
|
10
|
-
attr_accessor :banners
|
11
|
-
|
12
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
-
def self.attribute_map
|
14
|
-
{
|
15
|
-
:banners => :banners
|
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
|
-
:banners => :"Banner"
|
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::Banners` 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::Banners`. 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?(:banners)
|
59
|
-
self.banners = attributes[:banners]
|
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
|
-
banners == other.banners
|
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
|
-
[banners].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
|