Class: DpnSwaggerEngine::SwaggersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dpn_swagger_engine/swaggers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



9
10
11
# File 'app/controllers/dpn_swagger_engine/swaggers_controller.rb', line 9

def index
  redirect_to swagger_path(@json_files.first[0]) if @json_files.size == 1
end

#showObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/dpn_swagger_engine/swaggers_controller.rb', line 13

def show
  respond_to do |format|
    api_id = params[:id]
    format.html do
      @swagger_json_url = swagger_path(api_id, format: :json)
    end
    format.json do
      send_file @json_files[api_id.to_sym], type: 'application/json', disposition: 'inline'
    end
  end
end