Class: RedSnow::Payload Abstract

Inherits:
NamedBlueprintNode show all
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

Attributes inherited from NamedBlueprintNode

#description, #name

Instance Method Summary collapse

Methods inherited from NamedBlueprintNode

#ensure_description_newlines

Constructor Details

#initialize(sc_payload_handle_resource) ⇒ Payload

Returns a new instance of Payload.

Parameters:

  • sc_payload_handle_resource (FFI::Pointer)


223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/redsnow/blueprint.rb', line 223

def initialize(sc_payload_handle_resource)
  @name = RedSnow::Binding.sc_payload_name(sc_payload_handle_resource)
  @description = RedSnow::Binding.sc_payload_description(sc_payload_handle_resource)
  @body = RedSnow::Binding.sc_payload_body(sc_payload_handle_resource)
  @schema = RedSnow::Binding.sc_payload_schema(sc_payload_handle_resource)

  sc_reference_handle_payload = RedSnow::Binding.sc_reference_handle_payload(sc_payload_handle_resource)
  sc_reference_id = RedSnow::Binding.sc_reference_id(sc_reference_handle_payload)

  if not sc_reference_id.empty?
    @reference = ReferenceNode.new(sc_reference_id)
  end

  sc_header_collection_handle_payload = RedSnow::Binding.sc_header_collection_handle_payload(sc_payload_handle_resource)
  @headers = Headers.new(sc_header_collection_handle_payload)
end

Instance Attribute Details

#bodyString

HTTP-message body or nil

Returns:

  • (String)

    the current value of body



215
216
217
# File 'lib/redsnow/blueprint.rb', line 215

def body
  @body
end

#headersHeaders

array of HTTP header fields of the message or nil

Returns:

  • (Headers)

    the current value of headers



215
216
217
# File 'lib/redsnow/blueprint.rb', line 215

def headers
  @headers
end

#parametersArray

ignored

Returns:

  • (Array)

    the current value of parameters



215
216
217
# File 'lib/redsnow/blueprint.rb', line 215

def parameters
  @parameters
end

#referenceHash

Symbol Reference if the payload is a reference

Returns:

  • (Hash)

    the current value of reference



215
216
217
# File 'lib/redsnow/blueprint.rb', line 215

def reference
  @reference
end

#schemaString

HTTP-message body validation schema or nil

Returns:

  • (String)

    the current value of schema



215
216
217
# File 'lib/redsnow/blueprint.rb', line 215

def schema
  @schema
end