Class: Swagger::Blocks::ResponseNode

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

Overview

Instance Attribute Summary

Attributes inherited from Node

#name, #version

Instance Method Summary collapse

Methods inherited from Node

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

Instance Method Details

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



616
617
618
619
620
# File 'lib/swagger/blocks.rb', line 616

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

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



610
611
612
613
614
# File 'lib/swagger/blocks.rb', line 610

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

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



606
607
608
# File 'lib/swagger/blocks.rb', line 606

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