Class: Aws::Plugins::StubResponses::Handler Private
- Inherits:
-
Seahorse::Client::Handler
- Object
- Seahorse::Client::Handler
- Aws::Plugins::StubResponses::Handler
- Defined in:
- lib/aws-sdk-core/plugins/stub_responses.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 Attribute Summary
Attributes inherited from Seahorse::Client::Handler
Instance Method Summary collapse
- #apply_stub(stub, response) ⇒ Object private
- #call(context) ⇒ Object private
- #signal_error(error, http_resp) ⇒ Object private
- #signal_http(stub, http_resp) ⇒ Object private
Methods inherited from Seahorse::Client::Handler
Constructor Details
This class inherits a constructor from Seahorse::Client::Handler
Instance Method Details
#apply_stub(stub, response) ⇒ 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.
52 53 54 55 56 57 58 59 |
# File 'lib/aws-sdk-core/plugins/stub_responses.rb', line 52 def apply_stub(stub, response) http_resp = response.context.http_response case when stub[:error] then signal_error(stub[:error], http_resp) when stub[:http] then signal_http(stub[:http], http_resp) when stub[:data] then response.data = stub[:data] end end |
#call(context) ⇒ 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.
45 46 47 48 49 50 |
# File 'lib/aws-sdk-core/plugins/stub_responses.rb', line 45 def call(context) stub = context.client.next_stub(context) resp = Seahorse::Client::Response.new(context: context) apply_stub(stub, resp) resp end |
#signal_error(error, http_resp) ⇒ 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.
61 62 63 64 65 66 67 |
# File 'lib/aws-sdk-core/plugins/stub_responses.rb', line 61 def signal_error(error, http_resp) if Exception === error http_resp.signal_error(error) else http_resp.signal_error(error.new) end end |
#signal_http(stub, http_resp) ⇒ 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.
71 72 73 74 75 76 77 78 |
# File 'lib/aws-sdk-core/plugins/stub_responses.rb', line 71 def signal_http(stub, http_resp) http_resp.signal_headers(stub.status_code, stub.headers.to_h) while chunk = stub.body.read(1024 * 1024) http_resp.signal_data(chunk) end stub.body.rewind http_resp.signal_done end |