Class: Fog::Proxmox::Identity::Domain

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

Overview

class Domain model authentication

Instance Method Summary collapse

Constructor Details

#initialize(new_attributes = {}) ⇒ Domain

Returns a new instance of Domain.



28
29
30
31
# File 'lib/fog/proxmox/identity/models/domain.rb', line 28

def initialize(new_attributes = {})
  initialize_type(new_attributes)
  super(new_attributes)
end

Instance Method Details

#destroyObject



40
41
42
43
44
# File 'lib/fog/proxmox/identity/models/domain.rb', line 40

def destroy
  requires :realm
  service.delete_domain(realm)
  true
end

#save(new_attributes = {}) ⇒ Object



33
34
35
36
37
38
# File 'lib/fog/proxmox/identity/models/domain.rb', line 33

def save(new_attributes = {})
  service.create_domain(type.attributes.merge(new_attributes).merge(attributes.reject do |attribute|
                                                                      [:type].include? attribute
                                                                    end))
  reload
end

#updateObject



46
47
48
49
50
51
52
# File 'lib/fog/proxmox/identity/models/domain.rb', line 46

def update
  requires :realm
  service.update_domain(realm, type.attributes.merge(attributes).reject do |attribute|
                                 %i[type realm].include? attribute
                               end)
  reload
end