Class: SwaggerYard::PathItem
- Inherits:
-
Object
- Object
- SwaggerYard::PathItem
- Defined in:
- lib/swagger_yard/path_item.rb
Instance Attribute Summary collapse
-
#api_group ⇒ Object
Returns the value of attribute api_group.
-
#operations ⇒ Object
Returns the value of attribute operations.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #add_operation(yard_object) ⇒ Object
-
#initialize(api_group = nil) ⇒ PathItem
constructor
A new instance of PathItem.
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_group ⇒ Object
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 |
#operations ⇒ Object
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 |