Class: Lumberg::Whm::Account
Overview
Some WHM functions require different params for the same ‘thing’ e.g. some accept ‘username’ while others accept ‘user’ Be sure to keep our API consistent and work around those inconsistencies internally
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add_package(options = {}) ⇒ Object
Adds a new hosting package.
-
#change_package(options = {}) ⇒ Object
Changes the hosting package associated with a cPanel account.
-
#change_password(options = {}) ⇒ Object
Changes the password of a domain owner (cPanel) or reseller (WHM) account.
-
#create(options = {}) ⇒ Object
Creates a hosting account and sets up its associated domain information.
-
#domain_user_data(options = {}) ⇒ Object
Obtains user data for a specific domain.
-
#edit_quota(options = {}) ⇒ Object
Changes an account’s disk space usage quota.
-
#limit_bandwidth(options = {}) ⇒ Object
Modifies the bandwidth usage (transfer) limit for a specific account.
-
#list(options = {}) ⇒ Object
Optional *
:searchtype
- PENDING *:search
- PENDING. -
#list_suspended(options = {}) ⇒ Object
Generates a list of suspended accounts.
-
#modify(options = {}) ⇒ Object
Modifies settings for an account.
-
#privs(options = {}) ⇒ Object
Generates a list of features you are allowed to use in WHM.
-
#remove(options = {}) ⇒ Object
Permanently removes a cPanel account.
-
#restore_account(options = {}) ⇒ Object
Restores a user’s account from a backup file.
-
#set_site_ip(options = {}) ⇒ Object
Changes the IP address of a website, or a user account, hosted on your server.
-
#summary(options = {}) ⇒ Object
Displays pertinent information about a specific account.
-
#suspend(options = {}) ⇒ Object
Prevents a cPanel user from accessing his or her account.
-
#unsuspend(options = {}) ⇒ Object
Unsuspend a suspended account.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Lumberg::Whm::Base
Instance Method Details
#add_package(options = {}) ⇒ Object
Adds a new hosting package
Required
* <tt>:name</tt> - PENDING
Optional
* <tt>:featurelist</tt> - PENDING
* <tt>:quota</tt> - PENDING
* <tt>:ip</tt> - PENDING
* <tt>:cgi</tt> - PENDING
* <tt>:frontpage</tt> - PENDING
* <tt>:cpmod</tt> - PENDING
* <tt>:language</tt> - PENDING
* <tt>:maxftp</tt> - PENDING
* <tt>:maxsql</tt> - PENDING
* <tt>:maxpop</tt> - PENDING
* <tt>:maxlists</tt> - PENDING
* <tt>:maxsub</tt> - PENDING
* <tt>:maxpark</tt> - PENDING
* <tt>:maxaddon</tt> - PENDING
* <tt>:hasshell</tt> - PENDING
* <tt>:bwlimit</tt> - PENDING
143 144 145 |
# File 'lib/lumberg/whm/account.rb', line 143 def add_package( = {}) server.perform_request('addpkg', ) end |
#change_package(options = {}) ⇒ Object
Changes the hosting package associated with a cPanel account
Required
* <tt>:username</tt> - PENDING
* <tt>:pkg</tt> - PENDING
152 153 154 155 |
# File 'lib/lumberg/whm/account.rb', line 152 def change_package( = {}) [:user] = .delete(:username) server.perform_request('changepackage', ) end |
#change_password(options = {}) ⇒ Object
Changes the password of a domain owner (cPanel) or reseller (WHM) account
Required
* <tt>:username</tt> - PENDING
* <tt>:password</tt> - PENDING
42 43 44 45 46 |
# File 'lib/lumberg/whm/account.rb', line 42 def change_password( = {}) [:user] = .delete(:username) [:pass] = .delete(:password) server.perform_request('passwd', .merge(response_key: 'passwd')) end |
#create(options = {}) ⇒ Object
Creates a hosting account and sets up its associated domain information
Required
* <tt>:username</tt> - PENDING
* <tt>:domain</tt> - PENDING
* <tt>:password</tt> - PENDING
Optional
* <tt>:plan</tt> - PENDING
* <tt>:pkgname</tt> - PENDING
* <tt>:savepkg</tt> - PENDING
* <tt>:featurelist</tt> - PENDING
* <tt>:quota</tt> - PENDING
* <tt>:ip</tt> - PENDING
* <tt>:cgi</tt> - PENDING
* <tt>:</tt> - PENDING
24 25 26 |
# File 'lib/lumberg/whm/account.rb', line 24 def create( = {}) server.perform_request('createacct', ) end |
#domain_user_data(options = {}) ⇒ Object
Obtains user data for a specific domain
Required
* <tt>:domain</tt> - PENDING
161 162 163 164 165 |
# File 'lib/lumberg/whm/account.rb', line 161 def domain_user_data( = {}) server.perform_request('domainuserdata', .merge(response_key: 'userdata')) do |s| s.boolean_params = :hascgi end end |
#edit_quota(options = {}) ⇒ Object
Changes an account’s disk space usage quota
Required
* <tt>:username</tt> - PENDING
* <tt>:quota</tt> - PENDING
116 117 118 119 |
# File 'lib/lumberg/whm/account.rb', line 116 def edit_quota( = {}) [:user] = .delete(:username) server.perform_request('editquota', ) end |
#limit_bandwidth(options = {}) ⇒ Object
Modifies the bandwidth usage (transfer) limit for a specific account
Required
* <tt>:username</tt> - PENDING
* <tt>:bwlimit</tt> - PENDING
62 63 64 65 66 67 68 69 |
# File 'lib/lumberg/whm/account.rb', line 62 def limit_bandwidth( = {}) verify_user([:username]) do [:user] = .delete(:username) server.perform_request('limitbw', ) do |s| s.boolean_params = :unlimited, :bwlimitenable end end end |
#list(options = {}) ⇒ Object
Optional
* <tt>:searchtype</tt> - PENDING
* <tt>:search</tt> - PENDING
77 78 79 80 81 |
# File 'lib/lumberg/whm/account.rb', line 77 def list( = {}) server.perform_request('listaccts', ) do |s| s.boolean_params = :suspended end end |
#list_suspended(options = {}) ⇒ Object
Generates a list of suspended accounts
189 190 191 |
# File 'lib/lumberg/whm/account.rb', line 189 def list_suspended( = {}) server.perform_request('listsuspended', ) end |
#modify(options = {}) ⇒ Object
Modifies settings for an account
Required
* <tt>:username</tt> - PENDING
Optional
* <tt>:domain</tt> - PENDING
* <tt>:newuser</tt> - PENDING
* <tt>:owner</tt> - PENDING
* <tt>:CPTHEME</tt> - PENDING
* <tt>:HASCGI</tt> - PENDING
* <tt>:LANG</tt> - PENDING
* <tt>:LOCALE</tt> - PENDING
* <tt>:MAXFTP</tt> - PENDING
* <tt>:MAXSQL</tt> - PENDING
* <tt>:MAXPOP</tt> - PENDING
* <tt>:MAXLST</tt> - PENDING
* <tt>:MAXSUB</tt> - PENDING
* <tt>:MAXPARK</tt> - PENDING
* <tt>:MAXADDON</tt> - PENDING
* <tt>:shell</tt> - PENDING
104 105 106 107 108 109 |
# File 'lib/lumberg/whm/account.rb', line 104 def modify( = {}) [:user] = .delete(:username) server.perform_request('modifyacct', ) do |s| s.boolean_params = :DEMO end end |
#privs(options = {}) ⇒ Object
Generates a list of features you are allowed to use in WHM. Each feature will display either a 1 or 0. You are only able to use features with a corresponding 1
Required
* <tt>:username</tt> - PENDING
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/lumberg/whm/account.rb', line 197 def privs( ={}) verify_user([:username]) do resp = server.perform_request('myprivs', .merge(response_key: 'privs')) do |s| s.boolean_params = :all end # if you get this far, it's successful resp[:success] = true resp end end |
#remove(options = {}) ⇒ Object
Permanently removes a cPanel account
Required
* <tt>:username</tt> - PENDING
32 33 34 35 |
# File 'lib/lumberg/whm/account.rb', line 32 def remove( = {}) [:user] = .delete(:username) server.perform_request('removeacct', ) end |
#restore_account(options = {}) ⇒ Object
Restores a user’s account from a backup file. You may restore a monthly, weekly, or daily backup
Required
* <tt>:username</tt> - PENDING
* <tt>:type</tt> - PENDING
* <tt>:all</tt> - PENDING
* <tt>:ip</tt> - PENDING
* <tt>:mail</tt> - PENDING
* <tt>:mysql</tt> - PENDING
* <tt>:subs</tt> - PENDING
227 228 229 230 |
# File 'lib/lumberg/whm/account.rb', line 227 def restore_account( = {}) [:user] = .delete(:username) if [:username] server.perform_request('restoreaccount', .merge(response_key: 'metadata')) end |
#set_site_ip(options = {}) ⇒ Object
Changes the IP address of a website, or a user account, hosted on your server
Required
* <tt>:ip</tt> - PENDING
212 213 214 215 |
# File 'lib/lumberg/whm/account.rb', line 212 def set_site_ip( = {}) [:user] = .delete(:username) if [:username] server.perform_request('setsiteip', ) end |
#summary(options = {}) ⇒ Object
Displays pertinent information about a specific account
Required
* <tt>:username</tt> - PENDING
52 53 54 55 |
# File 'lib/lumberg/whm/account.rb', line 52 def summary( = {}) [:user] = .delete(:username) server.perform_request('accountsummary', ) end |
#suspend(options = {}) ⇒ Object
Prevents a cPanel user from accessing his or her account. Once an account is suspended, it can be un-suspended to allow a user to access the account again
Required
* <tt>:username</tt> - PENDING
Optional
* <tt>:reason</tt> - PENDING
174 175 176 177 |
# File 'lib/lumberg/whm/account.rb', line 174 def suspend( ={}) [:user] = .delete(:username) server.perform_request('suspendacct', ) end |
#unsuspend(options = {}) ⇒ Object
Unsuspend a suspended account. When a user’s account is unsuspended, he or she will be able to access cPanel again
Required
* <tt>:username</tt> - PENDING
183 184 185 186 |
# File 'lib/lumberg/whm/account.rb', line 183 def unsuspend( ={}) [:user] = .delete(:username) server.perform_request('unsuspendacct', ) end |