class Dnsmadeeasy_verify::Domain

Attributes

id[RW]
name[RW]

Public Class Methods

new(id, name) click to toggle source
# File lib/dnsmadeeasy_verify/domain.rb, line 10
def initialize(id, name)
  @id = id
  @name = name
end

Public Instance Methods

available() click to toggle source
# File lib/dnsmadeeasy_verify/domain.rb, line 15
def available
  @whois ||= Whois.whois(@name)
  @whois.available?
end
do_name_servers_contain(domain) click to toggle source
# File lib/dnsmadeeasy_verify/domain.rb, line 25
def do_name_servers_contain(domain)
  name_servers = get_name_servers
  return name_servers.any?{ |s| s.downcase().include?(domain) }
end
get_name_servers() click to toggle source
# File lib/dnsmadeeasy_verify/domain.rb, line 30
def get_name_servers
  ns = []
  res = Dnsruby::Resolver.new
  ns_req = nil
  begin
    ns_req = res.query(@name, "NS")
  rescue Exception => e
    return []
  end
  if (ns_req.header.ancount == 0)
    return []
  end

  (ns_req.answer.select {|r| r.type == "NS"}).each do |nsrr|
    ns << nsrr.domainname.to_s
  end

  ns
end
registered() click to toggle source
# File lib/dnsmadeeasy_verify/domain.rb, line 20
def registered
  @whois ||= Whois.whois(@name)
  @whois.registered?
end