Class: Lumberg::Cpanel::DomainLookup

Inherits:
Base show all
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

#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

#countObject

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(options = {})
  perform_request({ api_function: 'getdocroot' }.merge(options))
end

#document_rootsObject 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

#listObject

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