module Doorkeeper
Main Doorkeeper
namespace.
Define methods that can be called in any controller that inherits from Doorkeeper::ApplicationMetalController or Doorkeeper::ApplicationController
Attributes
orm_adapter[R]
Public Class Methods
authenticate(request, methods = Doorkeeper.config.access_token_methods)
click to toggle source
# File lib/doorkeeper.rb, line 182 def authenticate(request, methods = Doorkeeper.config.access_token_methods) OAuth::Token.authenticate(request, *methods) end
configuration()
click to toggle source
@return [Doorkeeper::Config] configuration instance
# File lib/doorkeeper.rb, line 128 def configuration @config || configure end
Also aliased as: config
configure(&block)
click to toggle source
# File lib/doorkeeper.rb, line 120 def configure(&block) @config = Config::Builder.new(&block).build setup @config end
configured?()
click to toggle source
# File lib/doorkeeper.rb, line 132 def configured? !@config.nil? end
gem_version()
click to toggle source
# File lib/doorkeeper.rb, line 186 def gem_version ::Gem::Version.new(::Doorkeeper::VERSION::STRING) end
run_orm_hooks()
click to toggle source
# File lib/doorkeeper.rb, line 160 def run_orm_hooks config.clear_cache! if @orm_adapter.respond_to?(:run_hooks) @orm_adapter.run_hooks else ::Kernel.warn <<~MSG.strip_heredoc [DOORKEEPER] ORM "#{configuration.orm}" should move all it's setup logic under `#run_hooks` method for the #{@orm_adapter.name}. Later versions of Doorkeeper will no longer support `setup_orm_models` and `setup_application_owner` API. MSG end end
setup()
click to toggle source
# File lib/doorkeeper.rb, line 138 def setup setup_orm_adapter # Deprecated, will be removed soon unless configuration.orm == :active_record setup_orm_models setup_application_owner end end
setup_application_owner()
click to toggle source
# File lib/doorkeeper.rb, line 178 def setup_application_owner @orm_adapter.initialize_application_owner! end
setup_orm_adapter()
click to toggle source
# File lib/doorkeeper.rb, line 148 def setup_orm_adapter @orm_adapter = "doorkeeper/orm/#{configuration.orm}".classify.constantize rescue NameError => e raise e, "ORM adapter not found (#{configuration.orm})", <<-ERROR_MSG.strip_heredoc [DOORKEEPER] ORM adapter not found (#{configuration.orm}), or there was an error trying to load it. You probably need to add the related gem for this adapter to work with doorkeeper. ERROR_MSG end
setup_orm_models()
click to toggle source
# File lib/doorkeeper.rb, line 174 def setup_orm_models @orm_adapter.initialize_models! end