Class: Doorkeeper::Rails::Routes

Inherits:
Object
  • Object
show all
Extended by:
Registry
Includes:
AbstractRouter
Defined in:
lib/doorkeeper/rails/routes.rb,
lib/doorkeeper/rails/routes/mapper.rb,
lib/doorkeeper/rails/routes/mapping.rb,
lib/doorkeeper/rails/routes/registry.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Helper, Registry Classes: Mapper, Mapping

Constant Summary

Constants included from Registry

Registry::InvalidRouterClass, Registry::ROUTES_ACCESS_LOCK, Registry::ROUTES_DEFINITION_LOCK

Instance Attribute Summary

Attributes included from AbstractRouter

#routes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Registry

register_routes, registered_routes

Constructor Details

#initialize(routes, mapper = Mapper.new, &block) ⇒ Routes

Returns a new instance of Routes.


30
31
32
# File 'lib/doorkeeper/rails/routes.rb', line 30

def initialize(routes, mapper = Mapper.new, &block)
  super
end

Class Method Details

.install!Object


24
25
26
27
28
# File 'lib/doorkeeper/rails/routes.rb', line 24

def self.install!
  ActionDispatch::Routing::Mapper.include Doorkeeper::Rails::Routes::Helper

  registered_routes.each(&:install!)
end

Instance Method Details

#generate_routes!(options) ⇒ Object


34
35
36
37
38
39
40
41
42
43
44
# File 'lib/doorkeeper/rails/routes.rb', line 34

def generate_routes!(options)
  routes.scope options[:scope] || "oauth", as: "oauth" do
    map_route(:authorizations, :authorization_routes)
    map_route(:tokens, :token_routes)
    map_route(:tokens, :revoke_routes)
    map_route(:tokens, :introspect_routes) unless Doorkeeper.config.allow_token_introspection.is_a?(FalseClass)
    map_route(:applications, :application_routes)
    map_route(:authorized_applications, :authorized_applications_routes)
    map_route(:token_info, :token_info_routes)
  end
end