class EchoService

A test service with an echo implementation.

Attributes

received_md[R]

Public Class Methods

new(**kw) click to toggle source
# File src/ruby/spec/support/services.rb, line 39
def initialize(**kw)
  @trailing_metadata = kw
  @received_md = []
end

Public Instance Methods

a_bidi_rpc(requests, call) click to toggle source
# File src/ruby/spec/support/services.rb, line 65
def a_bidi_rpc(requests, call)
  call.output_metadata.update(@trailing_metadata)
  requests.each do |r|
    GRPC.logger.info(r)
  end
  [EchoMsg.new, EchoMsg.new]
end
a_client_streaming_rpc(call) click to toggle source
# File src/ruby/spec/support/services.rb, line 51
def a_client_streaming_rpc(call)
  # iterate through requests so call can complete
  call.output_metadata.update(@trailing_metadata)
  call.each_remote_read.each do |r|
    GRPC.logger.info(r)
  end
  EchoMsg.new
end
a_server_streaming_rpc(_req, call) click to toggle source
# File src/ruby/spec/support/services.rb, line 60
def a_server_streaming_rpc(_req, call)
  call.output_metadata.update(@trailing_metadata)
  [EchoMsg.new, EchoMsg.new]
end
an_rpc(req, call) click to toggle source
# File src/ruby/spec/support/services.rb, line 44
def an_rpc(req, call)
  GRPC.logger.info('echo service received a request')
  call.output_metadata.update(@trailing_metadata)
  @received_md << call.metadata unless call.metadata.nil?
  req
end