Class: Swagger::V2::Path
- Inherits:
-
SwaggerObject
- Object
- Hashie::Dash
- SwaggerObject
- Swagger::V2::Path
- Extended by:
- Forwardable
- Defined in:
- lib/swagger/v2/path.rb
Overview
Class representing a Swagger “Path Item Object”.
Constant Summary collapse
- VERBS =
[:get, :put, :post, :delete, :options, :head, :patch].freeze
Instance Attribute Summary
Attributes inherited from SwaggerObject
Instance Method Summary collapse
-
#each_parameter ⇒ Object
Iterates over each Path level parameter.
- #operations ⇒ Object
- #path ⇒ Object
- #uri_template ⇒ Object
Methods inherited from SwaggerObject
field, #initialize, required_field
Methods included from Attachable
#attach_parent, #attach_to_children, #root
Constructor Details
This class inherits a constructor from Swagger::SwaggerObject
Instance Method Details
#each_parameter ⇒ Object
Iterates over each Path level parameter.
34 35 36 37 38 39 |
# File 'lib/swagger/v2/path.rb', line 34 def each_parameter return if parameters.nil? parameters.each do |parameter| yield parameter end end |
#operations ⇒ Object
18 19 20 21 22 23 |
# File 'lib/swagger/v2/path.rb', line 18 def operations VERBS.each_with_object({}) do |v, h| operation = send v h[v] = operation if operation end end |
#path ⇒ Object
29 30 31 |
# File 'lib/swagger/v2/path.rb', line 29 def path parent.paths.key self end |
#uri_template ⇒ Object
25 26 27 |
# File 'lib/swagger/v2/path.rb', line 25 def uri_template "#{parent.host}#{parent.base_path}#{path}" end |