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

Instance Method Details

#example(exam, &block) ⇒ Object



593
594
595
596
597
# File 'lib/swagger/blocks.rb', line 593

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

#header(head, &block) ⇒ Object



587
588
589
590
591
# File 'lib/swagger/blocks.rb', line 587

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

#schema(&block) ⇒ Object



583
584
585
# File 'lib/swagger/blocks.rb', line 583

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