Class: Swagger::V2::Path

Inherits:
SwaggerObject show all
Extended by:
Forwardable
Defined in:
lib/swagger/v2/path.rb

Overview

Class representing a Swagger “Path Item Object”.

See Also:

Constant Summary collapse

VERBS =
[:get, :put, :post, :delete, :options, :head, :patch].freeze

Instance Attribute Summary

Attributes inherited from SwaggerObject

#parent

Instance Method Summary collapse

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_parameterObject

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

#operationsObject



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

#pathObject



29
30
31
# File 'lib/swagger/v2/path.rb', line 29

def path
  parent.paths.key self
end

#uri_templateObject



25
26
27
# File 'lib/swagger/v2/path.rb', line 25

def uri_template
  "#{parent.host}#{parent.base_path}#{path}"
end