Class: Mountapi::OpenApi::Document

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Document

Returns a new instance of Document.



9
10
11
# File 'lib/mountapi/open_api/document.rb', line 9

def initialize(string)
  @spec = Openapi3Parser.load(string)
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



7
8
9
# File 'lib/mountapi/open_api/document.rb', line 7

def spec
  @spec
end

Instance Method Details

#routesObject



13
14
15
16
17
# File 'lib/mountapi/open_api/document.rb', line 13

def routes
  spec.paths.inject([]) do |acc, path|
    acc.concat(Path.new(*path, version).to_routes)
  end
end