Class: SwaggerEngine::SwaggersController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



9
10
11
# File 'app/controllers/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
# File 'app/controllers/swagger_engine/swaggers_controller.rb', line 13

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