lib/algolia/models/search/time_range.rb in algolia-3.0.0.alpha.5 vs lib/algolia/models/search/time_range.rb in algolia-3.0.0.alpha.6
- old
+ new
@@ -98,19 +98,19 @@
attributes = attributes.transform_keys(&:to_sym)
transformed_hash = {}
types_mapping.each_pair do |key, type|
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_s] = nil
+ transformed_hash[key.to_sym] = nil
elsif type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
end
elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
end
end
new(transformed_hash)
end
@@ -165,9 +165,13 @@
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
+ end
+
+ def to_json(*_args)
+ to_hash.to_json
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash