You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

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

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

Instance Method Summary collapse

Constructor Details

#initialize(parser_class, rules) ⇒ Body

Returns a new instance of Body

Parameters:

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


10
11
12
13
# File 'gems/aws-sdk-core/lib/aws-sdk-core/rest/response/body.rb', line 10

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

Instance Method Details

#apply(body, data) ⇒ Object

Parameters:

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


17
18
19
20
21
22
23
24
25
# File 'gems/aws-sdk-core/lib/aws-sdk-core/rest/response/body.rb', line 17

def apply(body, data)
  if streaming?
    data[@rules[: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