Class: Swagger::Document
- Inherits:
-
Object
- Object
- Swagger::Document
- Defined in:
- lib/swagger/document.rb
Instance Method Summary collapse
- #api(path, opts = {}) {|a| ... } ⇒ Object
- #as_json(options) ⇒ Object
-
#initialize(base_path, opts = {}) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(base_path, opts = {}) ⇒ Document
Returns a new instance of Document.
3 4 5 6 7 8 9 10 |
# File 'lib/swagger/document.rb', line 3 def initialize base_path, opts = {} defaults = { :swaggerVersion => "1.1", :basePath => base_path, :apis => [], } @values = defaults.merge opts end |
Instance Method Details
#api(path, opts = {}) {|a| ... } ⇒ Object
12 13 14 15 16 17 |
# File 'lib/swagger/document.rb', line 12 def api path, opts = {} a = Api.new(path, opts) yield(a) @values[:apis] << a a end |
#as_json(options) ⇒ Object
19 20 21 |
# File 'lib/swagger/document.rb', line 19 def as_json @values.as_json end |