Class: Swagger::Blocks::Nodes::ResponseNode

Inherits:
Swagger::Blocks::Node show all
Defined in:
lib/swagger/blocks/nodes/response_node.rb

Overview

Instance Attribute Summary

Attributes inherited from Swagger::Blocks::Node

#name, #version

Instance Method Summary collapse

Methods inherited from Swagger::Blocks::Node

#as_json, call, #data, #is_swagger_2_0?, #key, #keys

Instance Method Details

#example(exam, inline_keys = nil, &block) ⇒ Object


16
17
18
19
20
# File 'lib/swagger/blocks/nodes/response_node.rb', line 16

def example(exam, inline_keys = nil, &block)
  # TODO validate 'exam' is as per spec
  self.data[:examples] ||= {}
  self.data[:examples][exam] = Swagger::Blocks::Nodes::ExampleNode.call(version: version, inline_keys: inline_keys, &block)
end

#header(head, inline_keys = nil, &block) ⇒ Object


10
11
12
13
14
# File 'lib/swagger/blocks/nodes/response_node.rb', line 10

def header(head, inline_keys = nil, &block)
  # TODO validate 'head' is as per spec
  self.data[:headers] ||= {}
  self.data[:headers][head] = Swagger::Blocks::Nodes::HeaderNode.call(version: version, inline_keys: inline_keys, &block)
end

#schema(inline_keys = nil, &block) ⇒ Object


6
7
8
# File 'lib/swagger/blocks/nodes/response_node.rb', line 6

def schema(inline_keys = nil, &block)
  self.data[:schema] = Swagger::Blocks::Nodes::SchemaNode.call(version: version, inline_keys: inline_keys, &block)
end