Class: Fog::Compute::ProfitBricks::User

Inherits:
Models::ProfitBricks::Base show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Methods inherited from Models::ProfitBricks::Base

#failed?, #ready?, #request_status, #wait_for

Constructor Details

#initialize(attributes = {}) ⇒ User

Returns a new instance of User.


34
35
36
# File 'lib/fog/profitbricks/models/compute/user.rb', line 34

def initialize(attributes = {})
  super
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options


32
33
34
# File 'lib/fog/profitbricks/models/compute/user.rb', line 32

def options
  @options
end

Instance Method Details

#deleteObject


70
71
72
73
74
# File 'lib/fog/profitbricks/models/compute/user.rb', line 70

def delete
  requires :id
  service.delete_user(id)
  true
end

#saveObject


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/profitbricks/models/compute/user.rb', line 38

def save
  requires :firstname, :lastname, :email, :password

  options = {}

  options[:firstname]     = firstname
  options[:lastname]      = lastname
  options[:email]         = email
  options[:password]      = password
  options[:administrator] = administrator if administrator
  options[:forceSecAuth]  = force_sec_auth if force_sec_auth

  data = service.create_user(options)
  merge_attributes(flatten(data.body))
  true
end

#updateObject


55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fog/profitbricks/models/compute/user.rb', line 55

def update
  requires :id, :firstname, :lastname, :email, :administrator, :force_sec_auth

  options = {}
  options[:firstname]     = firstname
  options[:lastname]      = lastname
  options[:email]         = email
  options[:administrator] = administrator
  options[:forceSecAuth]  = force_sec_auth

  data = service.update_user(id, options)
  merge_attributes(flatten(data.body))
  true
end