Class: OasCore::Spec::Paths
- Inherits:
-
Object
- Object
- OasCore::Spec::Paths
- Includes:
- Specable
- Defined in:
- lib/oas_core/spec/paths.rb
Instance Attribute Summary collapse
-
#path_items ⇒ Object
Returns the value of attribute path_items.
Instance Method Summary collapse
- #add_path(path, oas_routes) ⇒ Object
-
#initialize(specification) ⇒ Paths
constructor
A new instance of Paths.
- #to_spec ⇒ Object
Methods included from Specable
Constructor Details
#initialize(specification) ⇒ Paths
Returns a new instance of Paths.
10 11 12 13 |
# File 'lib/oas_core/spec/paths.rb', line 10 def initialize(specification) @specification = specification @path_items = {} end |
Instance Attribute Details
#path_items ⇒ Object
Returns the value of attribute path_items.
8 9 10 |
# File 'lib/oas_core/spec/paths.rb', line 8 def path_items @path_items end |
Instance Method Details
#add_path(path, oas_routes) ⇒ Object
15 16 17 |
# File 'lib/oas_core/spec/paths.rb', line 15 def add_path(path, oas_routes) @path_items[path] = Builders::PathItemBuilder.new(@specification).with_oas_routes(oas_routes).build end |
#to_spec ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/oas_core/spec/paths.rb', line 19 def to_spec paths_hash = {} @path_items.each do |path, path_object| paths_hash[path] = path_object.to_spec end paths_hash end |