lib/fanforce/main.rb in fanforce-0.1.3 vs lib/fanforce/main.rb in fanforce-0.1.4

- old
+ new

@@ -61,20 +61,20 @@ raise UnknownError.new(response, request, path, query) end response end - def auth(key_or_hash=nil) - if present?(key_or_hash) - key_or_hash.is_a?(Hash) ? auth_hash = key_or_hash.symbolize_keys : auth_hash = {key: key_or_hash} - @auth_hash = {key: key} if present?(auth_hash[:key]) + def auth(auth_hash=nil) + if present?(auth_hash) + auth_hash = auth_hash.is_a?(Hash) ? auth_hash.symbolize_keys : {api_key: auth_hash} + @auth_hash[:api_key] if present?(auth_hash[:api_key]) @auth_hash[:fanforce_id] if present?(auth_hash[:fanforce_id]) end @auth_hash end def valid_auth? - present?(@auth_hash) and present?(@auth_hash[:key]) + present?(@auth_hash) and present?(@auth_hash[:api_key]) end def apply_auth(params) params.merge(@auth_hash || {}) end