lib/loquor/api_calls/index.rb in loquor-0.5.0 vs lib/loquor/api_calls/index.rb in loquor-0.5.1
- old
+ new
@@ -50,14 +50,15 @@
end
def generate_url
query_string = []
@criteria.each do |key,value|
- if value.is_a?(String)
- query_string << "#{key}=#{URI.encode(value)}"
- elsif value.is_a?(Array)
+ case value
+ when String, Symbol, Numeric
+ query_string << "#{key}=#{URI.encode(value.to_s)}"
+ when Array
value.each do |v|
- query_string << "#{key}[]=#{URI.encode(v)}"
+ query_string << "#{key}[]=#{URI.encode(v.to_s)}"
end
else
raise LoquorError.new("Filter values must be strings or arrays.")
end
end