Class: Lumberg::Cpanel::SubDomain

Inherits:
Base show all
Defined in:
lib/lumberg/cpanel/sub_domain.rb

Instance Attribute Summary

Attributes inherited from Base

#api_username

Attributes inherited from Whm::Base

#server

Instance Method Summary collapse

Methods inherited from Base

api_module, #initialize, #perform_request

Methods inherited from Whm::Base

#initialize, #setup_server

Constructor Details

This class inherits a constructor from Lumberg::Cpanel::Base

Instance Method Details

#add(options = {}) ⇒ Object

Public: Add a subdomain.

options - Hash options for API call params (default: {}):

:domain      - String local part of the subdomain to add.
               "sub" if "sub.domain.com".
:rootdomain  - String domain on which to add the subdomain.
:dir         - String docroot for subdomain (optional, default:
               "public_html/[:domain value]")
:disallowdot - String value (optional). Set to "1" to strip "."
               chars from specified :domain value.

Returns Hash API response.



16
17
18
19
20
# File 'lib/lumberg/cpanel/sub_domain.rb', line 16

def add(options = {})
  perform_request({
    api_function: "addsubdomain"
  }.merge(options))
end

#list(options = {}) ⇒ Object

Public: Get list of subdomains.

options - Hash options for API call params (default: {}):

:regex - String regular expression to filter results (optional).

Returns Hash API response.



40
41
42
43
44
# File 'lib/lumberg/cpanel/sub_domain.rb', line 40

def list(options = {})
  perform_request({
    api_function: "listsubdomains"
  }.merge(options))
end

#modify(options = {}) ⇒ Object

Public: Modify the document root of a subdomain

options - Hash options for API call params (default: {}):

:dir         - String docroot to which you want to move the subdomain
:subdomain   - String subdomain whose docroot you want to modify
:rootdomain  - String domain on which to modify the subdomain

Returns Hash API response



54
55
56
57
58
# File 'lib/lumberg/cpanel/sub_domain.rb', line 54

def modify(options = {})
  perform_request({
    api_function: "changedocroot"
  }.merge(options))
end

#remove(options = {}) ⇒ Object

Public: Remove a subdomain.

options - Hash options for API call params (default: {}):

:domain - String subdomain to delete.

Returns Hash API response.



28
29
30
31
32
# File 'lib/lumberg/cpanel/sub_domain.rb', line 28

def remove(options = {})
  perform_request({
    api_function: "delsubdomain"
  }.merge(options))
end