Class: TestClientInterceptor

Inherits:
GRPC::ClientInterceptor show all
Defined in:
src/ruby/spec/support/services.rb

Overview

For testing client interceptors

Instance Method Summary collapse

Methods inherited from GRPC::Interceptor

#initialize

Constructor Details

This class inherits a constructor from GRPC::Interceptor

Instance Method Details

#bidi_streamer(requests:, call:, method:, metadata: {}) ⇒ Object



144
145
146
147
148
149
150
151
152
153
# File 'src/ruby/spec/support/services.rb', line 144

def bidi_streamer(requests:, call:, method:, metadata: {})
  GRPC.logger.info("Received bidi streamer call at method #{method}" \
    "with requests #{requests} for call #{call}" \
    " and metadata: #{}")
  requests.each do |r|
    GRPC.logger.info("In client interceptor: #{r}")
  end
  ['foo'] = 'bar_from_bidi_streamer'
  yield
end

#client_streamer(requests:, call:, method:, metadata: {}) ⇒ Object



125
126
127
128
129
130
131
132
133
134
# File 'src/ruby/spec/support/services.rb', line 125

def client_streamer(requests:, call:, method:, metadata: {})
  GRPC.logger.info("Received client streamer call at method #{method}" \
    " with requests #{requests} for call #{call}" \
    " and metadata: #{}")
  requests.each do |r|
    GRPC.logger.info("In client interceptor: #{r}")
  end
  ['foo'] = 'bar_from_client_streamer'
  yield
end

#request_response(request:, call:, method:, metadata: {}) ⇒ Object



117
118
119
120
121
122
123
# File 'src/ruby/spec/support/services.rb', line 117

def request_response(request:, call:, method:, metadata: {})
  GRPC.logger.info("Intercepted request/response call at method #{method}" \
    " with request #{request} for call #{call}" \
    " and metadata: #{}")
  ['foo'] = 'bar_from_request_response'
  yield
end

#server_streamer(request:, call:, method:, metadata: {}) ⇒ Object



136
137
138
139
140
141
142
# File 'src/ruby/spec/support/services.rb', line 136

def server_streamer(request:, call:, method:, metadata: {})
  GRPC.logger.info("Received server streamer call at method #{method}" \
    " with request #{request} for call #{call}" \
    " and metadata: #{}")
  ['foo'] = 'bar_from_server_streamer'
  yield
end