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]
Instance Attribute Summary
Attributes inherited from SwaggerObject
Instance Method Summary collapse
-
#initialize(hash) ⇒ Path
constructor
A new instance of Path.
- #operations ⇒ Object
- #path ⇒ Object
- #uri_template ⇒ Object
Methods inherited from SwaggerObject
Methods included from Attachable
#attach_parent, #attach_to_children, #root
Constructor Details
#initialize(hash) ⇒ Path
Returns a new instance of Path.
18 19 20 21 |
# File 'lib/swagger/v2/path.rb', line 18 def initialize(hash) hash[:parameters] ||= [] super end |
Instance Method Details
#operations ⇒ Object
23 24 25 26 27 28 |
# File 'lib/swagger/v2/path.rb', line 23 def operations VERBS.each_with_object({}) do | v, h | operation = send v h[v] = operation if operation end end |
#path ⇒ Object
34 35 36 |
# File 'lib/swagger/v2/path.rb', line 34 def path parent.paths.key self end |
#uri_template ⇒ Object
30 31 32 |
# File 'lib/swagger/v2/path.rb', line 30 def uri_template "#{parent.host}#{parent.base_path}#{path}" end |