Class: Aws::Rest::Response::Body Private

Inherits:
Object
  • Object
show all
Includes:
Seahorse::Model::Shapes
Defined in:
lib/aws-sdk-core/rest/response/body.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(parser_class, rules) ⇒ Body

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Body.

Parameters:

  • parser_class (Class)
  • rules (Seahorse::Model::ShapeRef)


12
13
14
15
# File 'lib/aws-sdk-core/rest/response/body.rb', line 12

def initialize(parser_class, rules)
  @parser_class = parser_class
  @rules = rules
end

Instance Method Details

#apply(body, data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • body (IO)
  • data (Hash, Struct)


19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aws-sdk-core/rest/response/body.rb', line 19

def apply(body, data)
  if event_stream?
    data[@rules[:payload]] = parse_eventstream(body)
  elsif streaming?
    # empty blob payloads are omitted
    data[@rules[:payload]] = body unless empty_blob_payload?(body)
  elsif @rules[:payload]
    data[@rules[:payload]] = parse(body.read, @rules[:payload_member])
  elsif !@rules.shape.member_names.empty?
    parse(body.read, @rules, data)
  end
end