Class: Swagger::Blocks::Nodes::PathNode
- Inherits:
-
Swagger::Blocks::Node
- Object
- Swagger::Blocks::Node
- Swagger::Blocks::Nodes::PathNode
- Defined in:
- lib/swagger/blocks/nodes/path_node.rb
Overview
Constant Summary collapse
- OPERATION_TYPES =
[:get, :put, :post, :delete, :options, :head, :patch].freeze
Constants inherited from Swagger::Blocks::Node
Swagger::Blocks::Node::VERSION_2, Swagger::Blocks::Node::VERSION_3
Instance Attribute Summary
Attributes inherited from Swagger::Blocks::Node
Instance Method Summary collapse
-
#operation(op, inline_keys = nil, &block) ⇒ Object
TODO support ^x- Vendor Extensions.
- #parameter(inline_keys = nil, &block) ⇒ Object
- #server(inline_keys = nil, &block) ⇒ Object
Methods inherited from Swagger::Blocks::Node
#as_json, call, #data, #is_openapi_3_0?, #is_swagger_2_0?, #key, #keys, #ref?, #static_ref?, #value_as_json
Instance Method Details
#operation(op, inline_keys = nil, &block) ⇒ Object
TODO support ^x- Vendor Extensions
9 10 11 12 13 |
# File 'lib/swagger/blocks/nodes/path_node.rb', line 9 def operation(op, inline_keys = nil, &block) op = op.to_sym raise ArgumentError.new("#{name} not in #{OPERATION_TYPES}") if !OPERATION_TYPES.include?(op) self.data[op] = Swagger::Blocks::Nodes::OperationNode.call(version: version, inline_keys: inline_keys, &block) end |
#parameter(inline_keys = nil, &block) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/swagger/blocks/nodes/path_node.rb', line 15 def parameter(inline_keys = nil, &block) inline_keys = {'$ref' => "#/parameters/#{inline_keys}"} if inline_keys.is_a?(Symbol) self.data[:parameters] ||= [] self.data[:parameters] << Swagger::Blocks::Nodes::ParameterNode.call(version: version, inline_keys: inline_keys, &block) end |
#server(inline_keys = nil, &block) ⇒ Object
22 23 24 25 26 |
# File 'lib/swagger/blocks/nodes/path_node.rb', line 22 def server(inline_keys = nil, &block) raise NotSupportedError unless is_openapi_3_0? self.data[:servers] ||= [] self.data[:servers] << Swagger::Blocks::Nodes::ServerNode.call(version: version, inline_keys: inline_keys, &block) end |