Class: RedSnow::Payload Abstract
- Inherits:
-
NamedBlueprintNode
- Object
- BlueprintNode
- NamedBlueprintNode
- RedSnow::Payload
- Defined in:
- lib/redsnow/blueprint.rb
Overview
This class is abstract.
HTTP message payload Blueprint AST node
base class for 'payload sections'
Instance Attribute Summary collapse
-
#body ⇒ String
HTTP-message body or nil.
-
#headers ⇒ Headers
array of HTTP header fields of the message or nil.
-
#parameters ⇒ Array
ignored.
-
#reference ⇒ Hash
Symbol Reference if the payload is a reference.
-
#schema ⇒ String
HTTP-message body validation schema or nil.
Attributes inherited from NamedBlueprintNode
Instance Method Summary collapse
-
#initialize(payload) ⇒ Payload
constructor
A new instance of Payload.
Methods inherited from NamedBlueprintNode
Constructor Details
#initialize(payload) ⇒ Payload
Returns a new instance of Payload.
202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/redsnow/blueprint.rb', line 202 def initialize(payload) @name = payload.fetch('name', '') @description = payload.fetch('description', '') @body = payload.fetch('body', '') @schema = payload.fetch('schema', '') if payload.key?('reference') && payload['reference'].key?('id') @reference = ReferenceNode.new(payload['reference']['id']) end @headers = Headers.new(payload.fetch('headers', nil)) end |
Instance Attribute Details
#body ⇒ String
HTTP-message body or nil
195 196 197 |
# File 'lib/redsnow/blueprint.rb', line 195 def body @body end |
#headers ⇒ Headers
array of HTTP header fields of the message or nil
195 196 197 |
# File 'lib/redsnow/blueprint.rb', line 195 def headers @headers end |
#parameters ⇒ Array
ignored
195 196 197 |
# File 'lib/redsnow/blueprint.rb', line 195 def parameters @parameters end |
#reference ⇒ Hash
Symbol Reference if the payload is a reference
195 196 197 |
# File 'lib/redsnow/blueprint.rb', line 195 def reference @reference end |
#schema ⇒ String
HTTP-message body validation schema or nil
195 196 197 |
# File 'lib/redsnow/blueprint.rb', line 195 def schema @schema end |