lib/fanforce/utils.rb in fanforce-0.3.8 vs lib/fanforce/utils.rb in fanforce-0.3.9

- old
+ new

@@ -40,11 +40,11 @@ return false if is_blank?(params[:api_key]) return true end def remove_nil_values(hash) - hash.delete_if {|k,v| v.nil? } + hash.clone.delete_if {|k,v| v.nil? } end def collect_known_params(params) if is_present?(params[:app_id]) plugin_type = :app @@ -61,14 +61,14 @@ end remove_nil_values(:"#{plugin_type}_id" => params["#{plugin_type}_id"], plugin_type: plugin_type, plugin_id: plugin_id, fanforce_id: params[:fanforce_id], fanforce_slug: params[:fanforce_slug], api_key: params[:api_key]) end def remove_internal_params(params) - params.delete_if { |k,v| [:app_id, :behavior_id, :module_id, :widget_id, :plugin_type, :plugin_id, :fanforce_id, :fanforce_slug, :api_key].include? k } + params.clone.delete_if { |k,v| [:app_id, :behavior_id, :module_id, :widget_id, :plugin_type, :plugin_id, :fanforce_id, :fanforce_slug, :api_key].include? k } end def remove_sensitive_params(params) - params.delete_if { |k,v| [:api_key].include? k } + params.clone.delete_if { |k,v| [:api_key].include? k } end def parse_url(raw_url) return if is_blank?(raw_url) url = URI::parse(raw_url)