Class: SwaggerParser::Path

Inherits:
SourceBasedObject show all
Includes:
Extendable, Referable
Defined in:
lib/swagger_parser/path.rb

Constant Summary collapse

OPERATION_NAMES =
%w(
  delete
  get
  head
  options
  patch
  post
  put
)

Instance Attribute Summary

Attributes inherited from SourceBasedObject

#source

Instance Method Summary collapse

Methods included from Referable

#ref

Methods included from Extendable

#extensions

Methods inherited from SourceBasedObject

#initialize

Constructor Details

This class inherits a constructor from SwaggerParser::SourceBasedObject

Instance Method Details

#deleteSwaggerParser::Operation?



22
23
24
25
26
# File 'lib/swagger_parser/path.rb', line 22

def delete
  if source["delete"]
    SwaggerParser::Operation.new(source["delete"], http_method: "DELETE")
  end
end

#getSwaggerParser::Operation?



29
30
31
32
33
# File 'lib/swagger_parser/path.rb', line 29

def get
  if source["get"]
    SwaggerParser::Operation.new(source["get"], http_method: "GET")
  end
end

#headSwaggerParser::Operation?



36
37
38
39
40
# File 'lib/swagger_parser/path.rb', line 36

def head
  if source["head"]
    SwaggerParser::Operation.new(source["head"], http_method: "HEAD")
  end
end

#operationsArray<SwaggerParser::Operation>



43
44
45
46
47
# File 'lib/swagger_parser/path.rb', line 43

def operations
  OPERATION_NAMES.map do |operation_name|
    send(operation_name)
  end.compact
end

#optionsSwaggerParser::Operation?



50
51
52
53
54
# File 'lib/swagger_parser/path.rb', line 50

def options
  if source["options"]
    SwaggerParser::Operation.new(source["options"], http_method: "OPTIONS")
  end
end

#parametersObject



57
58
59
# File 'lib/swagger_parser/path.rb', line 57

def parameters
  source["parameters"]
end

#patchSwaggerParser::Operation?



62
63
64
65
66
# File 'lib/swagger_parser/path.rb', line 62

def patch
  if source["patch"]
    SwaggerParser::Operation.new(source["patch"], http_method: "PATCH")
  end
end

#postSwaggerParser::Operation?



69
70
71
72
73
# File 'lib/swagger_parser/path.rb', line 69

def post
  if source["post"]
    SwaggerParser::Operation.new(source["post"], http_method: "POST")
  end
end

#putSwaggerParser::Operation?



76
77
78
79
80
# File 'lib/swagger_parser/path.rb', line 76

def put
  if source["put"]
    SwaggerParser::Operation.new(source["put"], http_method: "PUT")
  end
end