class Doorkeeper::Rails::Routes

:nodoc:

def self.install!

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

def application_routes(mapping)

def application_routes(mapping)
  routes.resources :doorkeeper_applications,
                   controller: mapping[:controllers],
                   as: :applications,
                   path: "applications"
end

def authorization_routes(mapping)

def authorization_routes(mapping)
  routes.resource(
    :authorization,
    path: "authorize",
    only: %i[create destroy],
    as: mapping[:as],
    controller: mapping[:controllers]
  ) do
    routes.get "/native", action: :show, on: :member
    routes.get "/", action: :new, on: :member
  end
end

def authorized_applications_routes(mapping)

def authorized_applications_routes(mapping)
  routes.resources :authorized_applications,
                   only: %i[index destroy],
                   controller: mapping[:controllers]
end

def generate_routes!(options)

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)
    map_route(:applications, :application_routes)
    map_route(:authorized_applications, :authorized_applications_routes)
    map_route(:token_info, :token_info_routes)
  end
end

def initialize(routes, &block)

def initialize(routes, &block)
  @routes = routes
  @mapping = Mapper.new.map(&block)
  if Doorkeeper.configuration.api_only
    @mapping.skips.push(:applications, :authorized_applications)
  end
end

def introspect_routes(mapping)

def introspect_routes(mapping)
  routes.post "introspect", controller: mapping[:controllers], action: :introspect
end

def map_route(name, method)

def map_route(name, method)
  return if @mapping.skipped?(name)
  send(method, @mapping[name])
  mapping[name] = @mapping[name]
end

def revoke_routes(mapping)

def revoke_routes(mapping)
  routes.post "revoke", controller: mapping[:controllers], action: :revoke
end

def token_info_routes(mapping)

def token_info_routes(mapping)
  routes.resource(
    :token_info,
    path: "token/info",
    only: [:show], as: mapping[:as],
    controller: mapping[:controllers]
  )
end

def token_routes(mapping)

def token_routes(mapping)
  routes.resource(
    :token,
    path: "token",
    only: [:create], as: mapping[:as],
    controller: mapping[:controllers]
  )
end