Class: Aws::Stubbing::Protocols::Json Private

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

Instance Method Summary collapse

Instance Method Details

#stub_data(api, operation, 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.



6
7
8
9
10
11
12
13
# File 'lib/aws-sdk-core/stubbing/protocols/json.rb', line 6

def stub_data(api, operation, data)
  resp = Seahorse::Client::Http::Response.new
  resp.status_code = 200
  resp.headers["Content-Type"] = content_type(api)
  resp.headers["x-amzn-RequestId"] = "stubbed-request-id"
  resp.body = build_body(operation, data)
  resp
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.



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

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