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


150
151
152
153
154
155
156
157
158
159
# File 'src/ruby/spec/support/services.rb', line 150

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


131
132
133
134
135
136
137
138
139
140
# File 'src/ruby/spec/support/services.rb', line 131

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


123
124
125
126
127
128
129
# File 'src/ruby/spec/support/services.rb', line 123

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


142
143
144
145
146
147
148
# File 'src/ruby/spec/support/services.rb', line 142

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