Class: Napa::Ext::SwaggerDoc
- Inherits:
-
Object
- Object
- Napa::Ext::SwaggerDoc
- Defined in:
- lib/napa/ext/swagger_doc.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, api_doc_path: '/api_doc') ⇒ SwaggerDoc
constructor
A new instance of SwaggerDoc.
Constructor Details
#initialize(app, api_doc_path: '/api_doc') ⇒ SwaggerDoc
Returns a new instance of SwaggerDoc.
4 5 6 7 |
# File 'lib/napa/ext/swagger_doc.rb', line 4 def initialize app, api_doc_path: '/api_doc' @app = app @api_doc_path = api_doc_path end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/napa/ext/swagger_doc.rb', line 9 def call env if enabled? && api_doc?(env) [ '301', { 'Location' => target_swagger_url(env), 'Content-Type' => 'text/html' }, [] ] else app.call env end end |