Skip to content

Commit

Permalink
Rename Doorkeeper::Request method params for clarity
Browse files Browse the repository at this point in the history
The arguments are strings from the `request_type` and `grant_type`
parameters, not strategies.
  • Loading branch information
reidab committed Oct 27, 2015
1 parent 4313541 commit 2465e2e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/doorkeeper/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ module Doorkeeper
module Request
module_function

def authorization_strategy(strategy)
get_strategy strategy, Doorkeeper.configuration.authorization_response_types
def authorization_strategy(response_type)
get_strategy response_type, Doorkeeper.configuration.authorization_response_types
rescue NameError
raise Errors::InvalidAuthorizationStrategy
end

def token_strategy(strategy)
get_strategy strategy, Doorkeeper.configuration.token_grant_types
def token_strategy(grant_type)
get_strategy grant_type, Doorkeeper.configuration.token_grant_types
rescue NameError
raise Errors::InvalidTokenStrategy
end

def get_strategy(strategy, available)
fail Errors::MissingRequestStrategy unless strategy.present?
fail NameError unless available.include?(strategy.to_s)
"Doorkeeper::Request::#{strategy.to_s.camelize}".constantize
def get_strategy(grant_or_request_type, available)
fail Errors::MissingRequestStrategy unless grant_or_request_type.present?
fail NameError unless available.include?(grant_or_request_type.to_s)
"Doorkeeper::Request::#{grant_or_request_type.to_s.camelize}".constantize
end
end
end

0 comments on commit 2465e2e

Please sign in to comment.