Class: SwaggerYard::PathItem

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_yard/path_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_group = nil) ⇒ PathItem

Returns a new instance of PathItem.



5
6
7
8
# File 'lib/swagger_yard/path_item.rb', line 5

def initialize(api_group = nil)
  @api_group = api_group
  @operations = {}
end

Instance Attribute Details

#api_groupObject

Returns the value of attribute api_group.



3
4
5
# File 'lib/swagger_yard/path_item.rb', line 3

def api_group
  @api_group
end

#operationsObject

Returns the value of attribute operations.



3
4
5
# File 'lib/swagger_yard/path_item.rb', line 3

def operations
  @operations
end

Instance Method Details

#+(other) ⇒ Object



15
16
17
18
19
# File 'lib/swagger_yard/path_item.rb', line 15

def +(other)
  PathItem.new(api_group).tap do |pi|
    pi.operations = operations.merge(other.operations)
  end
end

#add_operation(yard_object) ⇒ Object



10
11
12
13
# File 'lib/swagger_yard/path_item.rb', line 10

def add_operation(yard_object)
  operation = Operation.from_yard_object(yard_object, self)
  @operations[operation.http_method.downcase] = operation
end