Method: Gruf::Client#call
- Defined in:
- lib/gruf/client.rb
#call(request_method, params = {}, metadata = {}, opts = {}, &block) ⇒ Gruf::Response
Call the client’s method with given params
required for the given above call error type that was returned
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/gruf/client.rb', line 82 def call(request_method, params = {}, = {}, opts = {}, &block) request_method = request_method.to_sym req = if params.respond_to?(:to_proto) || streaming_request?(request_method) params else request_object(request_method, params) end md = () call_sig = call_signature(request_method) unless call_sig raise NotImplementedError, "The method #{request_method} has not been implemented in this service." end resp, operation = execute(call_sig, req, md, opts, &block) raise @error_factory.from_exception(resp.result) unless resp.success? Gruf::Response.new(operation: operation, message: resp.result, execution_time: resp.time) end |