Class: EchoService
- Inherits:
-
Object
- Object
- EchoService
- Includes:
- GRPC::GenericService
- Defined in:
- src/ruby/spec/support/services.rb
Overview
A test service with an echo implementation.
Instance Attribute Summary collapse
-
#received_md ⇒ Object
readonly
Returns the value of attribute received_md.
Instance Method Summary collapse
- #a_bidi_rpc(requests, call) ⇒ Object
- #a_client_streaming_rpc(call) ⇒ Object
- #a_server_streaming_rpc(_req, call) ⇒ Object
- #an_rpc(req, call) ⇒ Object
-
#initialize(**kw) ⇒ EchoService
constructor
A new instance of EchoService.
Methods included from GRPC::GenericService
Constructor Details
#initialize(**kw) ⇒ EchoService
Returns a new instance of EchoService.
38 39 40 41 |
# File 'src/ruby/spec/support/services.rb', line 38 def initialize(**kw) = kw @received_md = [] end |
Instance Attribute Details
#received_md ⇒ Object (readonly)
Returns the value of attribute received_md.
36 37 38 |
# File 'src/ruby/spec/support/services.rb', line 36 def received_md @received_md end |
Instance Method Details
#a_bidi_rpc(requests, call) ⇒ Object
62 63 64 65 66 |
# File 'src/ruby/spec/support/services.rb', line 62 def a_bidi_rpc(requests, call) call..update() requests.each { |r| p r } [EchoMsg.new, EchoMsg.new] end |
#a_client_streaming_rpc(call) ⇒ Object
50 51 52 53 54 55 |
# File 'src/ruby/spec/support/services.rb', line 50 def a_client_streaming_rpc(call) # iterate through requests so call can complete call..update() call.each_remote_read.each { |r| p r } EchoMsg.new end |
#a_server_streaming_rpc(_req, call) ⇒ Object
57 58 59 60 |
# File 'src/ruby/spec/support/services.rb', line 57 def a_server_streaming_rpc(_req, call) call..update() [EchoMsg.new, EchoMsg.new] end |
#an_rpc(req, call) ⇒ Object
43 44 45 46 47 48 |
# File 'src/ruby/spec/support/services.rb', line 43 def an_rpc(req, call) GRPC.logger.info('echo service received a request') call..update() @received_md << call. unless call..nil? req end |