Class: Whm::Account

Inherits:
Object
  • Object
show all
Includes:
Validatable, Parameters
Defined in:
lib/whm/account.rb

Overview

:nodoc:

Constant Summary collapse

@@default_attributes =
{}
@@writable_attributes =
%w(username domain plan pkgname savepkg featurelist quota password ip cgi frontpage hasshell contactemail cpmod maxftp maxsql maxpop maxlst maxsub maxpark maxaddon bwlimit customip language useregns hasuseregns reseller)
@@readonly_attributes =
%w(disklimit diskused email ip owner partition plan startdate suspended suspendreason theme unix_startdate user)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parameters

#booleans!, #requires!, #valid_options!

Constructor Details

#initialize(attributes = {}) ⇒ Account

Returns a new instance of Account.



17
18
19
20
# File 'lib/whm/account.rb', line 17

def initialize(attributes = {})
  self.attributes = attributes
  self.writable_attributes = {}
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



9
10
11
# File 'lib/whm/account.rb', line 9

def attributes
  @attributes
end

#serverObject

Returns the value of attribute server.



8
9
10
# File 'lib/whm/account.rb', line 8

def server
  @server
end

#writable_attributesObject

Returns the value of attribute writable_attributes.



10
11
12
# File 'lib/whm/account.rb', line 10

def writable_attributes
  @writable_attributes
end

Instance Method Details

#package=(new_package) ⇒ Object



59
60
61
# File 'lib/whm/account.rb', line 59

def package=( new_package)
  server.change_package(:user => user, :pkg => new_package)
end

#password=(password) ⇒ Object



43
44
45
# File 'lib/whm/account.rb', line 43

def password=(password)
  server.(:user => user, :pass => password)
end

#suspend!(reason = '') ⇒ Object



47
48
49
# File 'lib/whm/account.rb', line 47

def suspend!( reason = '')
  server.(:user => user, :reason => reason)
end

#terminate!(keepdns = "n") ⇒ Object



55
56
57
# File 'lib/whm/account.rb', line 55

def terminate!( keepdns = "n")
 server.(:user => user,:keepdns => keepdns) 
end

#unsuspend!Object



51
52
53
# File 'lib/whm/account.rb', line 51

def unsuspend!
  server.(:user => user)    
end

#userObject Also known as: name



22
23
24
# File 'lib/whm/account.rb', line 22

def user
  self.attributes['user']
end