Class: Mountapi::OpenApi::Path

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, spec, version) ⇒ Path

Returns a new instance of Path.



8
9
10
11
12
# File 'lib/mountapi/open_api/path.rb', line 8

def initialize(path, spec, version)
  @path = path
  @spec = spec
  @version = version
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/mountapi/open_api/path.rb', line 6

def path
  @path
end

#specObject (readonly)

Returns the value of attribute spec.



6
7
8
# File 'lib/mountapi/open_api/path.rb', line 6

def spec
  @spec
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/mountapi/open_api/path.rb', line 6

def version
  @version
end

Instance Method Details

#operationsObject



14
15
16
17
18
# File 'lib/mountapi/open_api/path.rb', line 14

def operations
  operation_nodes.inject([]) do |ops, op|
    ops.push(Operation.new(*op, path, version))
  end
end

#to_routesObject



20
21
22
# File 'lib/mountapi/open_api/path.rb', line 20

def to_routes
  operations.map(&:to_route)
end