Class: Miniswag::Ui::Configuration
- Inherits:
-
Object
- Object
- Miniswag::Ui::Configuration
- Defined in:
- lib/miniswag/ui/configuration.rb
Instance Attribute Summary collapse
-
#assets_root ⇒ Object
readonly
Returns the value of attribute assets_root.
-
#basic_auth_enabled ⇒ Object
Returns the value of attribute basic_auth_enabled.
-
#config_object ⇒ Object
Returns the value of attribute config_object.
-
#oauth_config_object ⇒ Object
Returns the value of attribute oauth_config_object.
-
#template_locations ⇒ Object
readonly
Returns the value of attribute template_locations.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #basic_auth_credentials(username, password) ⇒ Object
-
#get_binding ⇒ Object
rubocop:disable Naming/AccessorMethodName.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #openapi_endpoint(url, name) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/miniswag/ui/configuration.rb', line 11 def initialize @template_locations = [ # preferred override location "#{Rack::Directory.new('').root}/swagger/index.erb", # backwards compatible override location "#{Rack::Directory.new('').root}/app/views/miniswag/ui/home/index.html.erb", # default location File.('index.erb', __dir__) ] @assets_root = File.('../../../vendor/swagger-ui-dist', __dir__) @config_object = {} @oauth_config_object = {} @basic_auth_enabled = false @title = 'Miniswag API Documentation' end |
Instance Attribute Details
#assets_root ⇒ Object (readonly)
Returns the value of attribute assets_root.
8 9 10 |
# File 'lib/miniswag/ui/configuration.rb', line 8 def assets_root @assets_root end |
#basic_auth_enabled ⇒ Object
Returns the value of attribute basic_auth_enabled.
9 10 11 |
# File 'lib/miniswag/ui/configuration.rb', line 9 def basic_auth_enabled @basic_auth_enabled end |
#config_object ⇒ Object
Returns the value of attribute config_object.
9 10 11 |
# File 'lib/miniswag/ui/configuration.rb', line 9 def config_object @config_object end |
#oauth_config_object ⇒ Object
Returns the value of attribute oauth_config_object.
9 10 11 |
# File 'lib/miniswag/ui/configuration.rb', line 9 def oauth_config_object @oauth_config_object end |
#template_locations ⇒ Object (readonly)
Returns the value of attribute template_locations.
8 9 10 |
# File 'lib/miniswag/ui/configuration.rb', line 8 def template_locations @template_locations end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/miniswag/ui/configuration.rb', line 9 def title @title end |
Instance Method Details
#basic_auth_credentials(username, password) ⇒ Object
32 33 34 |
# File 'lib/miniswag/ui/configuration.rb', line 32 def basic_auth_credentials(username, password) @config_object[:basic_auth] = { username: username, password: password } end |
#get_binding ⇒ Object
rubocop:disable Naming/AccessorMethodName
37 38 39 |
# File 'lib/miniswag/ui/configuration.rb', line 37 def get_binding binding end |
#openapi_endpoint(url, name) ⇒ Object
27 28 29 30 |
# File 'lib/miniswag/ui/configuration.rb', line 27 def openapi_endpoint(url, name) @config_object[:urls] ||= [] @config_object[:urls] << { url: url, name: name } end |