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



153
154
155
156
157
158
159
160
161
162
# File 'src/ruby/spec/support/services.rb', line 153

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



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

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



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

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



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

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