Class: Swaggard::Swagger::Path

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Path

Returns a new instance of Path.



9
10
11
12
# File 'lib/swaggard/swagger/path.rb', line 9

def initialize(path)
  @path = path
  @operations = {}
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/swaggard/swagger/path.rb', line 7

def path
  @path
end

Instance Method Details

#add_operation(operation) ⇒ Object



14
15
16
# File 'lib/swaggard/swagger/path.rb', line 14

def add_operation(operation)
  @operations[operation.http_method.downcase] = operation
end

#to_docObject



18
19
20
# File 'lib/swaggard/swagger/path.rb', line 18

def to_doc
  Hash[@operations.map { |http_method, operation| [http_method, operation.to_doc] }]
end