Class: ApiDocServer::DocsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api_doc_server/docs_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
# File 'app/controllers/api_doc_server/docs_controller.rb', line 7

def index
  redirect_to doc_path(@swagger_urls.keys.first) if single_doc_url_hash?
end

#showObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/api_doc_server/docs_controller.rb', line 11

def show
  swagger_url = @swagger_urls[params[:id].to_sym]
  @swagger_config = engine_config.doc_config.merge(
    'spec-url': swagger_url
  ).map do |attribute, value|
    "#{attribute}='#{value}'"
  end.join(' ').html_safe # rubocop:disable Rails/OutputSafety
  render action: :show, layout: 'layouts/swagger'
end