module Aws::AsyncClientStubs
def send_events
def send_events if config.stub_responses @send_events else msg = 'This method is only implemented for stubbed clients, and is '\ 'available when you enable stubbing in the constructor with `stub_responses: true`' raise NotImplementedError.new(msg) end end
def setup_stubbing
- Api: - private
def setup_stubbing @stubs = {} @stub_mutex = Mutex.new if Hash === @config.stub_responses @config.stub_responses.each do |operation_name, stubs| apply_stubs(operation_name, Array === stubs ? stubs : [stubs]) end end # When a client is stubbed allow the user to access the requests made @api_requests = [] # allow to access signaled events when client is stubbed @send_events = [] requests = @api_requests send_events = @send_events self.handle do |context| if input_stream = context[:input_event_stream_handler] stub_stream = StubStream.new stub_stream.send_events = send_events input_stream.event_emitter.stream = stub_stream input_stream.event_emitter.validate_event = context.config.validate_params end requests << { operation_name: context.operation_name, params: context.params, context: context } @handler.call(context) end end