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)


216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/redsnow/blueprint.rb', line 216

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)

  unless 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



209
210
211
# File 'lib/redsnow/blueprint.rb', line 209

def body
  @body
end

#headersHeaders

array of HTTP header fields of the message or nil

Returns:

  • (Headers)

    the current value of headers



209
210
211
# File 'lib/redsnow/blueprint.rb', line 209

def headers
  @headers
end

#parametersArray

ignored

Returns:

  • (Array)

    the current value of parameters



209
210
211
# File 'lib/redsnow/blueprint.rb', line 209

def parameters
  @parameters
end

#referenceHash

Symbol Reference if the payload is a reference

Returns:

  • (Hash)

    the current value of reference



209
210
211
# File 'lib/redsnow/blueprint.rb', line 209

def reference
  @reference
end

#schemaString

HTTP-message body validation schema or nil

Returns:

  • (String)

    the current value of schema



209
210
211
# File 'lib/redsnow/blueprint.rb', line 209

def schema
  @schema
end