Class: Aws::Stubbing::Protocols::RestJson Private

Inherits:
Rest
  • Object
show all
Defined in:
lib/aws-sdk-core/stubbing/protocols/rest_json.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.

Direct Known Subclasses

ApiGateway

Instance Method Summary collapse

Methods inherited from Rest

#stub_data

Instance Method Details

#body_for(_a, _b, rules, 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.



9
10
11
12
13
14
15
# File 'lib/aws-sdk-core/stubbing/protocols/rest_json.rb', line 9

def body_for(_a, _b, rules, data)
  if eventstream?(rules)
    encode_eventstream_response(rules, data, Aws::Json::Builder)
  else
    Aws::Json::Builder.new(rules).serialize(data)
  end
end

#stub_error(error_code) ⇒ 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.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/aws-sdk-core/stubbing/protocols/rest_json.rb', line 17

def stub_error(error_code)
  resp = Seahorse::Client::Http::Response.new
  resp.status_code = 400
  resp.body = <<~JSON.strip
    {
      "code": #{error_code.inspect},
      "message": "stubbed-response-error-message"
    }
  JSON
  resp
end