Method: Gruf::Client#initialize
- Defined in:
- lib/gruf/client.rb
#initialize(service:, options: {}, client_options: {}) ⇒ Client
Initialize the client and setup the stub
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/gruf/client.rb', line 57 def initialize(service:, options: {}, client_options: {}) @base_klass = service @service_klass = "#{base_klass}::Service".constantize @opts = || {} @opts[:password] = @opts.fetch(:password, '').to_s @opts[:hostname] = @opts.fetch(:hostname, Gruf.default_client_host) @opts[:channel_credentials] = @opts.fetch(:channel_credentials, Gruf.default_channel_credentials) @error_factory = Gruf::Client::ErrorFactory.new [:timeout] = parse_timeout([:timeout]) if .key?(:timeout) client = "#{service}::Stub".constantize.new(@opts[:hostname], build_ssl_credentials, **) super(client) end |