Class: Fog::Identity::OpenStack::V2::Users

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/identity/openstack/v2/models/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



13
14
15
16
17
# File 'lib/fog/identity/openstack/v2/models/users.rb', line 13

def all(options = {})
  options[:tenant_id] = tenant_id

  load_response(service.list_users(options), 'users')
end

#destroy(id) ⇒ Object



37
38
39
40
# File 'lib/fog/identity/openstack/v2/models/users.rb', line 37

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

#find_by_id(id) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/fog/identity/openstack/v2/models/users.rb', line 19

def find_by_id(id)
  find { |user| user.id == id } ||
    Fog::Identity::OpenStack::V2::User.new(
      service.get_user_by_id(id).body['user'].merge(
        'service' => service
      )
    )
end

#find_by_name(name) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/fog/identity/openstack/v2/models/users.rb', line 28

def find_by_name(name)
  find { |user| user.name == name } ||
    Fog::Identity::OpenStack::V2::User.new(
      service.get_user_by_name(name).body['user'].merge(
        'service' => service
      )
    )
end