Class: Doorkeeper::DeviceAuthorizationGrant::Rails::Routes

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

Overview

rubocop:disable Style/Documentation

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.



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

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

Instance Attribute Details

#routesObject

Returns the value of attribute routes.



23
24
25
# File 'lib/doorkeeper/device_authorization_grant/rails/routes.rb', line 23

def routes
  @routes
end

Class Method Details

.install!Object



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

def self.install!
  ::ActionDispatch::Routing::Mapper.include(
    ::Doorkeeper::DeviceAuthorizationGrant::Rails::Routes::Helper
  )
end

Instance Method Details

#generate_routes!(options) ⇒ Object

Parameters:

  • options (Hash)


31
32
33
34
35
36
37
38
# File 'lib/doorkeeper/device_authorization_grant/rails/routes.rb', line 31

def generate_routes!(options)
  @mapping = Mapper.new.map(&@block)

  routes.scope(options[:scope] || 'oauth', as: 'oauth') do
    map_route(:device_codes, :device_code_routes)
    map_route(:device_authorizations, :device_authorization_routes)
  end
end