Class: GRPC::Core::CompositeChannelCredentials

Inherits:
Object
  • Object
show all
Defined in:
src/ruby/lib/grpc/core/channel_credentials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel_creds, call_creds) ⇒ CompositeChannelCredentials

Returns a new instance of CompositeChannelCredentials.



47
48
49
50
# File 'src/ruby/lib/grpc/core/channel_credentials.rb', line 47

def initialize(channel_creds, call_creds)
  @channel_credentials = channel_creds
  @call_credentials = call_creds
end

Instance Attribute Details

#call_credentialsObject (readonly)

Returns the value of attribute call_credentials.



45
46
47
# File 'src/ruby/lib/grpc/core/channel_credentials.rb', line 45

def call_credentials
  @call_credentials
end

#channel_credentialsObject (readonly)

Returns the value of attribute channel_credentials.



45
46
47
# File 'src/ruby/lib/grpc/core/channel_credentials.rb', line 45

def channel_credentials
  @channel_credentials
end

Instance Method Details

#compose(*others) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'src/ruby/lib/grpc/core/channel_credentials.rb', line 52

def compose(*others)
  return self if others.empty?
  flat_others = others.flatten

  flat_others.each do |o|
    fail TypeError, "Argument to compose must be a CallCredentials, got #{o.class}" \
      unless o.is_a?(CallCredentials)
  end

  if @call_credentials
    CompositeChannelCredentials.new(@channel_credentials, @call_credentials.compose(*flat_others))
  else
    CompositeChannelCredentials.new(@channel_credentials, CompositeCallCredentials.new(flat_others))
  end
end