Class: Namecheap::Dns

Inherits:
Api
  • Object
show all
Defined in:
lib/namecheap/dns.rb

Constant Summary

Constants inherited from Api

Api::ENDPOINT, Api::ENVIRONMENT, Api::PRODUCTION, Api::SANDBOX

Instance Method Summary collapse

Methods inherited from Api

#delete, #get, #init_args, #post, #put, #request

Instance Method Details

#get_email_forwarding(domain, options = {}) ⇒ Object

Gets email forwarding settings for the requested domain.



37
38
39
40
# File 'lib/namecheap/dns.rb', line 37

def get_email_forwarding(domain, options = {})
  options = {DomainName: domain}.merge(options)
  get "domains.dns.getEmailForwarding", options
end

#get_hosts(sld, tld, options = {}) ⇒ Object

Retrieves DNS host record settings for the requested domain.



30
31
32
33
# File 'lib/namecheap/dns.rb', line 30

def get_hosts(sld, tld, options = {})
  options = {SLD: sld, TLD: tld}.merge(options)
  get "domains.dns.getHosts", options
end

#get_list(sld, tld, options = {}) ⇒ Object

Gets a list of DNS servers associated with the requested domain.



23
24
25
26
# File 'lib/namecheap/dns.rb', line 23

def get_list(sld, tld, options = {})
  options = {SLD: sld, TLD: tld}.merge(options)
  get "domains.dns.getList", options
end

#set_custom(sld, tld, nameservers = [], options = {}) ⇒ Object

Sets domain to use custom DNS servers.



12
13
14
15
16
17
18
19
# File 'lib/namecheap/dns.rb', line 12

def set_custom(sld, tld, nameservers = [], options = {})
  if nameservers.respond_to?(:join)
    nameservers = nameservers.join(",")
  end

  options = {SLD: sld, TLD: tld, Nameservers: nameservers}.merge(options)
  get "domains.dns.setCustom", options
end

#set_default(sld, tld, options = {}) ⇒ Object

Sets domain to use Namecheap's default DNS servers.



5
6
7
8
# File 'lib/namecheap/dns.rb', line 5

def set_default(sld, tld, options = {})
  options = {SLD: sld, TLD: tld}.merge(options)
  get "domains.dns.setDefault", options
end

#set_email_forwarding(domain, options = {}) ⇒ Object

Sets email forwarding for a domain name.



44
45
46
47
# File 'lib/namecheap/dns.rb', line 44

def set_email_forwarding(domain, options = {})
  options = {DomainName: domain}.merge(options)
  get "domains.dns.setEmailForwarding", options
end

#set_hosts(sld, tld, options = {}) ⇒ Object

Sets DNS host records settings for the requested domain.



51
52
53
54
# File 'lib/namecheap/dns.rb', line 51

def set_hosts(sld, tld, options = {})
  options = {SLD: sld, TLD: tld}.merge(options)
  get "domains.dns.setHosts", options
end