Class: Apiture::Swagger::Path

Inherits:
Node
  • Object
show all
Defined in:
lib/apiture/swagger/path.rb

Constant Summary collapse

REQUEST_METHODS =
[:get, :put, :post, :delete, :options, :head, :patch]

Instance Attribute Summary collapse

Attributes inherited from Node

#errors

Instance Method Summary collapse

Methods inherited from Node

attribute, attribute_names, #collect_errors, collect_errors, #extensions, hash, hash_names, inherited, list, list_names, #serializable_hash, #to_json, #valid?, #validate

Methods included from Utils::Inflections

acronym_regex, acronyms, #camelize, #constantize, #underscore

Constructor Details

#initialize(id) ⇒ Path

Returns a new instance of Path.



18
19
20
21
# File 'lib/apiture/swagger/path.rb', line 18

def initialize(id)
  super()
  @id = id
end

Instance Attribute Details

#idObject (readonly) Also known as: path_name

Returns the value of attribute id.



7
8
9
# File 'lib/apiture/swagger/path.rb', line 7

def id
  @id
end

Instance Method Details

#operationsObject



23
24
25
# File 'lib/apiture/swagger/path.rb', line 23

def operations
  REQUEST_METHODS.map { |m| __send__(m) }.compact
end

#operations_mapObject



27
28
29
30
31
32
33
34
# File 'lib/apiture/swagger/path.rb', line 27

def operations_map
  REQUEST_METHODS.reduce({}) do |m, method|
    if op = __send__(method)
      m[method] = op
    end
    m
  end
end