lib/fanforce/api/utils.rb in fanforce-api-0.31.0 vs lib/fanforce/api/utils.rb in fanforce-api-1.0.0
- old
+ new
@@ -1,12 +1,11 @@
-require 'fanforce/utils'
-
module Fanforce::API::Utils
- include Fanforce::Utils
- extend Fanforce::API::Utils
+ extend self
def self.included(base) base.extend(self) end
+ include Fanforce::Base::Utils
+
def valid_fanforce_js_request?(params=@params)
return false if !params.is_a?(Hash)
return false if is_blank?(params[:organization_id]) or is_blank?(params[:api_key])
return true
end
@@ -30,25 +29,8 @@
return false if !params.is_a?(Hash)
return false if is_blank?(params[:organization_id])
return false if is_blank?(params[:app_id])
return false if is_blank?(params[:api_key])
return true
- end
-
- def remove_nil_values(hash)
- hash.clone.delete_if {|k,v| v.nil? }
- end
-
- def collect_known_params(params)
- params = symbolize_keys(params)
- remove_nil_values(app_id: params[:app_id], organization_id: params[:organization_id], organization_slug: params[:organization_slug], api_key: params[:api_key], session_id: params[:session_id])
- end
-
- def remove_internal_params(params)
- params.clone.delete_if { |k,v| [:app_id, :organization_id, :organization_slug, :api_key].include? k }
- end
-
- def remove_sensitive_params(params)
- params.clone.delete_if { |k,v| [:api_key].include? k }
end
end