Class: ApiDocViewer::MainController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api_doc_viewer/main_controller.rb

Instance Method Summary collapse

Instance Method Details

#documentationObject



8
9
10
11
12
13
# File 'app/controllers/api_doc_viewer/main_controller.rb', line 8

def documentation
  path = File.join(Rails.root, 'doc', 'api', params[:link] || 'index.json')
  return head :unauthorized if path.include?('..') || !path.ends_with?('.json')
  return head :not_found unless File.exist?(path)
  render json: File.read(path)
end

#indexObject



5
6
# File 'app/controllers/api_doc_viewer/main_controller.rb', line 5

def index
end