Class: Fog::Rackspace::Identity::User

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rackspace/models/identity/user.rb

Instance Method Summary collapse

Instance Method Details

#credentialsObject



42
43
44
45
46
47
48
49
# File 'lib/fog/rackspace/models/identity/user.rb', line 42

def credentials
  @credentials ||= begin
    Fog::Rackspace::Identity::Credentials.new({
      :service => service,
      :user => self
    })
  end
end

#destroyObject



27
28
29
30
31
# File 'lib/fog/rackspace/models/identity/user.rb', line 27

def destroy
  requires :identity
  service.delete_user(identity)
  true
end

#rolesObject



33
34
35
36
37
38
39
40
# File 'lib/fog/rackspace/models/identity/user.rb', line 33

def roles
  @roles ||= begin
    Fog::Rackspace::Identity::Roles.new({
      :service => service,
      :user => self
    })
  end
end

#saveObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/rackspace/models/identity/user.rb', line 16

def save
  requires :username, :email, :enabled
  unless persisted?
    data = service.create_user(username, email, enabled, :password => password)
  else
    data = service.update_user(identity, username, email, enabled, :password => password)
  end
  merge_attributes(data.body['user'])
  true
end