AsyncResponse — AWS SDK for Ruby V3 (original) (raw)
Class: Seahorse::Client::Http::AsyncResponse
Inherits:
Defined in:
gems/aws-sdk-core/lib/seahorse/client/http/async_response.rb
Instance Attribute Summary
Attributes inherited from Response
#error, #headers, #status_code
Instance Method Summarycollapse
- #initialize(options = {}) ⇒ AsyncResponse constructor
A new instance of AsyncResponse. - #signal_done(options = {}) ⇒ Object
- #signal_headers(headers) ⇒ Object
Methods inherited from Response
#body, #body=, #body_contents, #on_data, #on_done, #on_error, #on_headers, #on_success, #reset, #signal_data, #signal_error
Constructor Details
#initialize(options = {}) ⇒ AsyncResponse
Returns a new instance of AsyncResponse.
8 9 10 | # File 'gems/aws-sdk-core/lib/seahorse/client/http/async_response.rb', line 8 def initialize(options = {}) super end |
---|
Instance Method Details
#signal_done(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # File 'gems/aws-sdk-core/lib/seahorse/client/http/async_response.rb', line 24 def signal_done(options = {}) if options.keys.sort == [:body, :headers] (options[:headers]) signal_data(options[:body]) signal_done elsif options.empty? @body.rewind if @body.respond_to?(:rewind) @done = true emit(:done) else msg = "options must be empty or must contain :headers and :body" raise ArgumentError, msg end end |
---|
| 12 13 14 15 16 17 18 19 20 21 22 | # File 'gems/aws-sdk-core/lib/seahorse/client/http/async_response.rb', line 12 def () hash = .inject({}) do |h, pair| key, value = pair h[key] = value h end @status_code = hash[":status"].to_i @headers = Headers.new(hash) emit(:headers, @status_code, @headers) end | | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |