Class: GRPC::Core::CallCredentials

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

Overview

CallCredentials represents per-call credentials.

Direct Known Subclasses

CompositeCallCredentials

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_proc = nil, &block) ⇒ CallCredentials

Returns a new instance of CallCredentials.



23
24
25
26
# File 'src/ruby/lib/grpc/core/call_credentials.rb', line 23

def initialize(auth_proc = nil, &block)
  @auth_proc = auth_proc || block
  fail TypeError, 'Argument to CallCredentials#new must be a proc' unless @auth_proc.is_a?(Proc)
end

Instance Attribute Details

#auth_procObject (readonly)

Returns the value of attribute auth_proc.



21
22
23
# File 'src/ruby/lib/grpc/core/call_credentials.rb', line 21

def auth_proc
  @auth_proc
end

Instance Method Details

#compose(*others) ⇒ Object



36
37
38
39
40
# File 'src/ruby/lib/grpc/core/call_credentials.rb', line 36

def compose(*others)
  return self if others.empty?
  valid_others = validate_credentials_list!(others)
  CompositeCallCredentials.new([self] + valid_others)
end

#composite?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'src/ruby/lib/grpc/core/call_credentials.rb', line 32

def composite?
  false
end

#get_metadata(context) ⇒ Object



28
29
30
# File 'src/ruby/lib/grpc/core/call_credentials.rb', line 28

def (context)
  @auth_proc.call(context)
end