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



602
603
604
605
606
# File 'lib/swagger/blocks.rb', line 602

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



596
597
598
599
600
# File 'lib/swagger/blocks.rb', line 596

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



592
593
594
# File 'lib/swagger/blocks.rb', line 592

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