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 38
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 62
def a_bidi_rpc(requests, call)
  call.output_metadata.update(@trailing_metadata)
  requests.each { |r| p r }
  [EchoMsg.new, EchoMsg.new]
end
a_client_streaming_rpc(call) click to toggle source
# File src/ruby/spec/support/services.rb, line 50
def a_client_streaming_rpc(call)
  # iterate through requests so call can complete
  call.output_metadata.update(@trailing_metadata)
  call.each_remote_read.each { |r| p r }
  EchoMsg.new
end
a_server_streaming_rpc(_req, call) click to toggle source
# File src/ruby/spec/support/services.rb, line 57
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 43
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