class Rswag::Ui::Configuration

Attributes

assets_root[R]
basic_auth_enabled[RW]
config_object[RW]
oauth_config_object[RW]
template_locations[R]

Public Class Methods

new() click to toggle source
# File lib/rswag/ui/configuration.rb, line 13
def initialize
  @template_locations = [
    # preffered override location
    "#{Rack::Directory.new('').root}/swagger/index.erb",
    # backwards compatible override location
    "#{Rack::Directory.new('').root}/app/views/rswag/ui/home/index.html.erb",
    # default location
    File.expand_path('../index.erb', __FILE__)
  ]
  @assets_root = File.expand_path('../../../../node_modules/swagger-ui-dist', __FILE__)
  @config_object = {}
  @oauth_config_object = {}
  @basic_auth_enabled = false
end

Public Instance Methods

basic_auth_credentials(username, password) click to toggle source
# File lib/rswag/ui/configuration.rb, line 33
def basic_auth_credentials(username, password)
  @config_object[:basic_auth] = { username: username, password: password }
end
get_binding() click to toggle source

rubocop:disable Naming/AccessorMethodName

# File lib/rswag/ui/configuration.rb, line 38
def get_binding
  binding
end
swagger_endpoint(url, name) click to toggle source
# File lib/rswag/ui/configuration.rb, line 28
def swagger_endpoint(url, name)
  @config_object[:urls] ||= []
  @config_object[:urls] << { url: url, name: name }
end