Class: WestfieldSwagger::SwaggerController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WestfieldSwagger::SwaggerController
- Defined in:
- app/controllers/westfield_swagger/swagger_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
- #specification_missing(exception) ⇒ Object
- #specification_parse_error(exception) ⇒ Object
Instance Method Details
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/westfield_swagger/swagger_controller.rb', line 6 def index if params[:service] # Access service swagger env_prefix = "" @service = "#{params[:service]}/" else # Access roll-up swagger env_prefix = "#{Rails.env}_" @service = "" end @spec = WestfieldSwagger::ApiSpecification.new(params[:version], binding, request, env_prefix) respond_to do |format| format.html format.json { render json: @spec.read } format.all { render text: "Format '#{params[:format]}' not supported", status: 404 } end end |
#specification_missing(exception) ⇒ Object
33 34 35 36 |
# File 'app/controllers/westfield_swagger/swagger_controller.rb', line 33 def specification_missing(exception) data = { error: exception. } render json: data, status: 404 end |
#specification_parse_error(exception) ⇒ Object
28 29 30 31 |
# File 'app/controllers/westfield_swagger/swagger_controller.rb', line 28 def specification_parse_error(exception) data = { error: exception. } render json: data, status: 500 end |