Class: Fog::OpenStack::Auth::Name

Inherits:
Struct
  • Object
show all
Defined in:
lib/fog/openstack/auth/name.rb,
lib/fog/openstack/auth/name.rb

Direct Known Subclasses

DomainScope, ProjectScope, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



24
25
26
# File 'lib/fog/openstack/auth/name.rb', line 24

def id
  @id
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



24
25
26
# File 'lib/fog/openstack/auth/name.rb', line 24

def name
  @name
end

Instance Method Details

#identityObject



26
27
28
29
30
# File 'lib/fog/openstack/auth/name.rb', line 26

def identity
  return to_h(:id) unless id.nil?
  return to_h(:name) unless name.nil?
  raise Fog::OpenStack::Auth::CredentialsError, "#{self.class}: No available id or name"
end

#to_h(var) ⇒ Object



32
33
34
# File 'lib/fog/openstack/auth/name.rb', line 32

def to_h(var)
  {var => send(var)}
end