Class: Seahorse::Client::Plugins::ResponseTarget::Handler Private

Inherits:
Handler
  • Object
show all
Defined in:
lib/seahorse/client/plugins/response_target.rb

Overview

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.

This handler is responsible for replacing the HTTP response body IO object with custom targets, such as a block, or a file. It is important to not write data to the custom target in the case of a non-success response. We do not want to write an XML error message to someone’s file.

Instance Attribute Summary

Attributes inherited from Handler

#handler

Instance Method Summary collapse

Methods inherited from Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#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.



18
19
20
21
22
23
24
25
# File 'lib/seahorse/client/plugins/response_target.rb', line 18

def call(context)
  if context.params.is_a?(Hash) && context.params[:response_target]
    context[:response_target] = context.params.delete(:response_target)
  end
  target = context[:response_target]
  add_event_listeners(context, target) if target
  @handler.call(context)
end