Class: DoctorSwagger::SwaggerDoc
- Inherits:
-
Object
- Object
- DoctorSwagger::SwaggerDoc
- Defined in:
- lib/doctor_swagger/swagger_doc.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#as_json ⇒ Object
TODO: add DSL for.
- #endpoint(path, &block) ⇒ Object
-
#initialize(resource_path, options = {}, &block) ⇒ SwaggerDoc
constructor
A new instance of SwaggerDoc.
Constructor Details
#initialize(resource_path, options = {}, &block) ⇒ SwaggerDoc
Returns a new instance of SwaggerDoc.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/doctor_swagger/swagger_doc.rb', line 4 def initialize(resource_path, = {}, &block) @resource_path = resource_path [:swagger_version] ||= DoctorSwagger.swagger_version [:api_version] ||= DoctorSwagger.api_version [:base_path] ||= DoctorSwagger.base_path @swagger_version = [:swagger_version] @api_version = [:api_version] @base_path = [:base_path] @endpoints = [] instance_eval(&block) end |
Instance Method Details
#as_json ⇒ Object
TODO: add DSL for
21 22 23 24 25 26 27 28 29 |
# File 'lib/doctor_swagger/swagger_doc.rb', line 21 def as_json(*) { 'apiVersion' => try_call(@api_version), 'swaggerVersion' => try_call(@swagger_version), 'basePath' => try_call(@base_path), 'resourcePath' => @resource_path, 'apis' => @endpoints.map(&:as_json) } end |