Class: OasRails::Spec::PathItem
- Inherits:
-
Object
- Object
- OasRails::Spec::PathItem
- Includes:
- Specable
- Defined in:
- lib/oas_rails/spec/path_item.rb
Instance Attribute Summary collapse
-
#delete ⇒ Object
readonly
Returns the value of attribute delete.
-
#get ⇒ Object
readonly
Returns the value of attribute get.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
-
#post ⇒ Object
readonly
Returns the value of attribute post.
-
#put ⇒ Object
readonly
Returns the value of attribute put.
Instance Method Summary collapse
- #add_operation(http_method, operation) ⇒ Object
- #fill_from(path, route_extractor: Extractors::RouteExtractor) ⇒ Object
-
#initialize(specification) ⇒ PathItem
constructor
A new instance of PathItem.
- #oas_fields ⇒ Object
Methods included from Specable
Constructor Details
#initialize(specification) ⇒ PathItem
Returns a new instance of PathItem.
7 8 9 10 11 12 13 14 |
# File 'lib/oas_rails/spec/path_item.rb', line 7 def initialize(specification) @specification = specification @get = nil @post = nil @put = nil @patch = nil @delete = nil end |
Instance Attribute Details
#delete ⇒ Object (readonly)
Returns the value of attribute delete.
5 6 7 |
# File 'lib/oas_rails/spec/path_item.rb', line 5 def delete @delete end |
#get ⇒ Object (readonly)
Returns the value of attribute get.
5 6 7 |
# File 'lib/oas_rails/spec/path_item.rb', line 5 def get @get end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
5 6 7 |
# File 'lib/oas_rails/spec/path_item.rb', line 5 def patch @patch end |
#post ⇒ Object (readonly)
Returns the value of attribute post.
5 6 7 |
# File 'lib/oas_rails/spec/path_item.rb', line 5 def post @post end |
#put ⇒ Object (readonly)
Returns the value of attribute put.
5 6 7 |
# File 'lib/oas_rails/spec/path_item.rb', line 5 def put @put end |
Instance Method Details
#add_operation(http_method, operation) ⇒ Object
24 25 26 |
# File 'lib/oas_rails/spec/path_item.rb', line 24 def add_operation(http_method, operation) instance_variable_set("@#{http_method}", operation) end |
#fill_from(path, route_extractor: Extractors::RouteExtractor) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/oas_rails/spec/path_item.rb', line 16 def fill_from(path, route_extractor: Extractors::RouteExtractor) route_extractor.host_routes_by_path(path).each do |oas_route| add_operation(oas_route.verb.downcase, Spec::Operation.new(@specification).fill_from(oas_route)) end self end |
#oas_fields ⇒ Object
28 29 30 |
# File 'lib/oas_rails/spec/path_item.rb', line 28 def oas_fields [:get, :post, :put, :patch, :delete] end |