Class: Fog::Identity::Proxmox::Users

Inherits:
Proxmox::Collection show all
Defined in:
lib/fog/identity/proxmox/models/users.rb

Overview

class Users model collection

Instance Attribute Summary

Attributes inherited from Proxmox::Collection

#response

Instance Method Summary collapse

Methods inherited from Proxmox::Collection

#clear_ignored_attributes, #create, #get, #load_response, #not_implemented, #read, #summary

Instance Method Details

#all(options = {}) ⇒ Object


30
31
32
# File 'lib/fog/identity/proxmox/models/users.rb', line 30

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

#destroy(id) ⇒ Object


43
44
45
46
# File 'lib/fog/identity/proxmox/models/users.rb', line 43

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

#find_by_id(id) ⇒ Object


34
35
36
37
38
39
40
41
# File 'lib/fog/identity/proxmox/models/users.rb', line 34

def find_by_id(id)
  cached_user = find { |user| user.userid == id }
  return cached_user if cached_user
  user_hash = service.get_user(id)
  Fog::Identity::Proxmox::User.new(
    user_hash.merge(service: service)
  )
end