A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/sdkforruby/api/Aws/Plugins/StubResponses/Handler.html below:

Handler — AWS SDK for Ruby V2

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

Class: Aws::Plugins::StubResponses::Handler Attribute Summary collapse Instance Attribute Summary Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Instance Method Details #apply_stub(stub, response) ⇒ Object
47
48
49
50
51
52
53
54
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/stub_responses.rb', line 47

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
40
41
42
43
44
45
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/stub_responses.rb', line 40

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
56
57
58
59
60
61
62
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/stub_responses.rb', line 56

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
66
67
68
69
70
71
72
73
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/stub_responses.rb', line 66

def signal_http(stub, http_resp)
  http_resp.(stub.status_code, stub..to_h)
  while chunk = stub.body.read(1024 * 1024)
    http_resp.signal_data(chunk)
  end
  stub.body.rewind
  http_resp.signal_done
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4