Class: Swagger::Blocks::Nodes::OperationNode
Overview
Constant Summary
Swagger::Blocks::Node::VERSION_2, Swagger::Blocks::Node::VERSION_3
Instance Attribute Summary
#name, #version
Instance Method Summary
collapse
#as_json, call, #data, #is_openapi_3_0?, #is_swagger_2_0?, #key, #keys, #ref?, #static_ref?, #value_as_json
Instance Method Details
#callback(event_name, inline_keys = nil, &block) ⇒ Object
32
33
34
35
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 32
def callback(event_name, inline_keys = nil, &block)
self.data[:callbacks] ||= {}
self.data[:callbacks][event_name] = Swagger::Blocks::Nodes::CallbackNode.call(version: version, inline_keys: inline_keys, &block)
end
|
#externalDocs(inline_keys = nil, &block) ⇒ Object
19
20
21
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 19
def externalDocs(inline_keys = nil, &block)
self.data[:externalDocs] = Swagger::Blocks::Nodes::ExternalDocsNode.call(version: version, inline_keys: inline_keys, &block)
end
|
#parameter(inline_keys = nil, &block) ⇒ Object
6
7
8
9
10
11
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 6
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
|
#request_body(inline_keys = nil, &block) ⇒ Object
28
29
30
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 28
def request_body(inline_keys = nil, &block)
self.data[:requestBody] = Swagger::Blocks::Nodes::RequestBodyNode.call(version: version, inline_keys: inline_keys, &block)
end
|
#response(resp, inline_keys = nil, &block) ⇒ Object
13
14
15
16
17
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 13
def response(resp, inline_keys = nil, &block)
self.data[:responses] ||= {}
self.data[:responses][resp] = Swagger::Blocks::Nodes::ResponseNode.call(version: version, inline_keys: inline_keys, &block)
end
|
#security(inline_keys = nil, &block) ⇒ Object
23
24
25
26
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 23
def security(inline_keys = nil, &block)
self.data[:security] ||= []
self.data[:security] << Swagger::Blocks::Nodes::SecurityRequirementNode.call(version: version, inline_keys: inline_keys, &block)
end
|
#server(inline_keys = nil, &block) ⇒ Object
37
38
39
40
41
|
# File 'lib/swagger/blocks/nodes/operation_node.rb', line 37
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
|