Class: Lumberg::Cpanel::DomainLookup
- Defined in:
- lib/lumberg/cpanel/domain_lookup.rb
Overview
Public: This module allows you to gather domain and document root maps from authenticated accounts.
Instance Attribute Summary
Attributes inherited from Base
Attributes inherited from Whm::Base
Instance Method Summary collapse
-
#count ⇒ Object
Public: Retrieve the total number of base domains associated with your cPanel account.
-
#document_root(options = {}) ⇒ Object
(also: #docroot)
Public: Retrieve the absolute and relative paths to a specific domain’s document root.
-
#document_roots ⇒ Object
(also: #docroots)
Public: Retrieve the full paths to all of your document roots.
-
#list ⇒ Object
Public: Retrieve parked, addon and main domains for a Cpanel account.
Methods inherited from Base
api_module, #initialize, #perform_request
Methods inherited from Whm::Base
Constructor Details
This class inherits a constructor from Lumberg::Cpanel::Base
Instance Method Details
#count ⇒ Object
Public: Retrieve the total number of base domains associated with your cPanel account.
Examples
api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
domain_lookup = Lumberg::Cpanel::DomainLookup.new(api_args.dup)
domain_lookup.count_domains
Returns Hash API response.
65 66 67 |
# File 'lib/lumberg/cpanel/domain_lookup.rb', line 65 def count perform_request({ api_function: 'countbasedomains' }) end |
#document_root(options = {}) ⇒ Object Also known as: docroot
Public: Retrieve the absolute and relative paths to a specific domain’s document root.
options - Hash options for API call params (default: {})
:domain - String domain corresponding to the document root you wish
to know (default: 'your main domain')
Examples
api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
domain_lookup = Lumberg::Cpanel::DomainLookup.new(api_args.dup)
# gets DocumentRoot for primary domain
domain_lookup.document_root
# gets DocumentRoot for addon domain (or subdomain)
domain_lookup.document_root(domain: 'addon.example.com')
Returns Hash API response.
36 37 38 |
# File 'lib/lumberg/cpanel/domain_lookup.rb', line 36 def document_root( = {}) perform_request({ api_function: 'getdocroot' }.merge()) end |
#document_roots ⇒ Object Also known as: docroots
Public: Retrieve the full paths to all of your document roots
Examples
api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
domain_lookup = Lumberg::Cpanel::DomainLookup.new(api_args.dup)
domain_lookup.document_roots
Returns Hash API response.
50 51 52 |
# File 'lib/lumberg/cpanel/domain_lookup.rb', line 50 def document_roots perform_request({ api_function: 'getdocroots' }) end |
#list ⇒ Object
Public: Retrieve parked, addon and main domains for a Cpanel account
Examples
api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
domain_lookup = Lumberg::Cpanel::DomainLookup.new(api_args.dup)
domain_lookup.list
Returns Hash API response.
15 16 17 |
# File 'lib/lumberg/cpanel/domain_lookup.rb', line 15 def list perform_request({ api_function: 'getbasedomains' }) end |