module Doorkeeper
Main Doorkeeper
namespace.
Define methods that can be called in any controller that inherits from Doorkeeper::ApplicationMetalController or Doorkeeper::ApplicationController
Attributes
Public Class Methods
Source
# File lib/doorkeeper.rb, line 187 def authenticate(request, methods = Doorkeeper.config.access_token_methods) OAuth::Token.authenticate(request, *methods) end
Source
# File lib/doorkeeper.rb, line 133 def configuration @config || configure end
@return [Doorkeeper::Config] configuration instance
Also aliased as: config
Source
# File lib/doorkeeper.rb, line 125 def configure(&block) @config = Config::Builder.new(&block).build setup @config end
Source
# File lib/doorkeeper.rb, line 191 def gem_version ::Gem::Version.new(::Doorkeeper::VERSION::STRING) end
Source
# File lib/doorkeeper.rb, line 165 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
Source
# File lib/doorkeeper.rb, line 143 def setup setup_orm_adapter # Deprecated, will be removed soon unless configuration.orm == :active_record setup_orm_models setup_application_owner end end
Source
# File lib/doorkeeper.rb, line 183 def setup_application_owner @orm_adapter.initialize_application_owner! end
Source
# File lib/doorkeeper.rb, line 153 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
Source
# File lib/doorkeeper.rb, line 179 def setup_orm_models @orm_adapter.initialize_models! end