Class: Stigg::Sidecar::Client

Inherits:
V1::SidecarService::Stub
  • Object
show all
Defined in:
lib/stigg_sidecar_sdk/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_config, remote_sidecar_host, remote_sidecar_port) ⇒ Client

Returns a new instance of Client.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/stigg_sidecar_sdk/client.rb', line 31

def initialize(api_config,
               remote_sidecar_host,
               remote_sidecar_port)
  host = "#{remote_sidecar_host}:#{remote_sidecar_port}"
  credentials = GRPC::Core::ChannelCredentials.new(File.read(File.join(__dir__, "certs/root-ca.pem")))
  super(host, credentials)
  api_key = api_config.api_key
  api_url = api_config.api_url || "https://api.stigg.io/graphql"
  request_timeout = api_config.request_timeout || 30
  @api = Stigg.create_client(api_key, api_url, request_timeout)
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



29
30
31
# File 'lib/stigg_sidecar_sdk/client.rb', line 29

def api
  @api
end