Class: Fog::Identity::OpenStack::V3::Users

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/openstack/models/identity_v3/users.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::Collection

#get, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object


11
12
13
# File 'lib/fog/openstack/models/identity_v3/users.rb', line 11

def all(options = {})
  load_response(service.list_users(options), 'users')
end

#destroy(id) ⇒ Object


27
28
29
30
# File 'lib/fog/openstack/models/identity_v3/users.rb', line 27

def destroy(id)
  user = self.find_by_id(id)
  user.destroy
end

#find_by_id(id) ⇒ Object


15
16
17
18
19
20
21
# File 'lib/fog/openstack/models/identity_v3/users.rb', line 15

def find_by_id(id)
  cached_user = self.find { |user| user.id == id }
  return cached_user if cached_user
  user_hash = service.get_user(id).body['user']
  Fog::Identity::OpenStack::V3::User.new(
      user_hash.merge(:service => service))
end

#find_by_name(name) ⇒ Object


23
24
25
# File 'lib/fog/openstack/models/identity_v3/users.rb', line 23

def find_by_name(name)
  load(service.list_users(:name => name).body['users'])
end