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

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/openstack/identity/v2/models/users.rb

Instance Attribute Summary

Attributes inherited from Collection

#response

Instance Method Summary collapse

Methods inherited from Collection

#get, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/fog/openstack/identity/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/openstack/identity/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/openstack/identity/v2/models/users.rb', line 19

def find_by_id(id)
  find { |user| user.id == id } ||
    Fog::OpenStack::Identity::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/openstack/identity/v2/models/users.rb', line 28

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