Class: Doorkeeper::Rails::Routes

Inherits:
Object
  • Object
show all
Defined in:
lib/doorkeeper/rails/routes.rb,
lib/doorkeeper/rails/routes/mapper.rb,
lib/doorkeeper/rails/routes/mapping.rb

Defined Under Namespace

Modules: Helper Classes: Mapper, Mapping

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routes, &block) ⇒ Routes

Returns a new instance of Routes.


20
21
22
# File 'lib/doorkeeper/rails/routes.rb', line 20

def initialize(routes, &block)
  @routes, @block = routes, block
end

Instance Attribute Details

#routesObject

Returns the value of attribute routes


18
19
20
# File 'lib/doorkeeper/rails/routes.rb', line 18

def routes
  @routes
end

Class Method Details

.install!Object


14
15
16
# File 'lib/doorkeeper/rails/routes.rb', line 14

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

Instance Method Details

#generate_routes!(options) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
# File 'lib/doorkeeper/rails/routes.rb', line 24

def generate_routes!(options)
  @mapping = Mapper.new.map(&@block)
  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(:applications, :application_routes)
    map_route(:authorized_applications, :authorized_applications_routes)
    map_route(:token_info, :token_info_routes)
  end
end