Class: Swagger::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger/document.rb

Instance Method Summary collapse

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

Yields:

  • (a)


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 options
  @values.as_json options
end