lib/keen/client.rb in keen-0.8.1 vs lib/keen/client.rb in keen-0.8.2
- old
+ new
@@ -99,10 +99,12 @@
def preprocess_params(params)
preprocess_encodables(params)
preprocess_timeframe(params)
preprocess_group_by(params)
+ preprocess_percentile(params)
+ preprocess_property_names(params)
query_params = ""
params.each do |param, value|
query_params << "#{param}=#{CGI.escape(value)}&"
end
@@ -128,9 +130,22 @@
def preprocess_group_by(params)
group_by = params[:group_by]
if group_by.is_a?(Array)
params[:group_by] = MultiJson.encode(group_by)
+ end
+ end
+
+ def preprocess_percentile(params)
+ if params.key?(:percentile)
+ params[:percentile] = params[:percentile].to_s
+ end
+ end
+
+ def preprocess_property_names(params)
+ property_names = params[:property_names]
+ if property_names.is_a?(Array)
+ params[:property_names] = MultiJson.encode(property_names)
end
end
def method_missing(_method, *args, &block)
if config = CONFIG[_method.to_sym]