Class: RHC::Rest::WWWAuth::DeferredCredential

Inherits:
Object
  • Object
show all
Defined in:
lib/rhc/rest/httpclient.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, password) ⇒ DeferredCredential

Returns a new instance of DeferredCredential.



102
103
104
# File 'lib/rhc/rest/httpclient.rb', line 102

def initialize(user, password)
  @user, @password = user, password
end

Instance Method Details

#passwdObject



108
109
110
# File 'lib/rhc/rest/httpclient.rb', line 108

def passwd
  (@password.call if @password.respond_to?(:call)) or @password
end

#to_strObject

Pretend to be a string



115
116
117
# File 'lib/rhc/rest/httpclient.rb', line 115

def to_str
  ["#{user}:#{passwd}"].pack('m').tr("\n", '')
end

#userObject



105
106
107
# File 'lib/rhc/rest/httpclient.rb', line 105

def user
  (@user.call if @user.respond_to?(:call)) or @user
end