Class: GrpcTypechecker::ClientInterceptor
- Inherits:
-
GRPC::ClientInterceptor
- Object
- GRPC::ClientInterceptor
- GrpcTypechecker::ClientInterceptor
- Defined in:
- lib/grpc_typechecker/client_interceptor.rb
Instance Method Summary collapse
- #bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil) ⇒ Object
- #client_streamer(requests: nil, call: nil, method: nil, metadata: nil) ⇒ Object
-
#initialize(service_class: nil) ⇒ ClientInterceptor
constructor
A new instance of ClientInterceptor.
- #request_response(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object
- #server_streamer(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object
Constructor Details
#initialize(service_class: nil) ⇒ ClientInterceptor
Returns a new instance of ClientInterceptor.
3 4 5 |
# File 'lib/grpc_typechecker/client_interceptor.rb', line 3 def initialize(service_class: nil) @service = service_class::Service end |
Instance Method Details
#bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil) ⇒ Object
25 26 27 28 |
# File 'lib/grpc_typechecker/client_interceptor.rb', line 25 def bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil) # no-op yield end |
#client_streamer(requests: nil, call: nil, method: nil, metadata: nil) ⇒ Object
15 16 17 18 |
# File 'lib/grpc_typechecker/client_interceptor.rb', line 15 def client_streamer(requests: nil, call: nil, method: nil, metadata: nil) # no-op yield end |
#request_response(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/grpc_typechecker/client_interceptor.rb', line 7 def request_response(request: nil, call: nil, method: nil, metadata: nil) # Raise InvalidArgument if the argument of gRPC method is ill-typed unless request.is_a?(request_class(method)) raise GRPC::InvalidArgument, "#{method}: expected an instance of #{request_class(method)}, got an instance of #{request.class}" end yield end |
#server_streamer(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object
20 21 22 23 |
# File 'lib/grpc_typechecker/client_interceptor.rb', line 20 def server_streamer(request: nil, call: nil, method: nil, metadata: nil) # no-op yield end |