class SiteInspector::Endpoint::Whois

Public Instance Methods

domain() click to toggle source
# File lib/site-inspector/checks/whois.rb, line 6
def domain
  @domain ||= whois.lookup host
end
ip() click to toggle source
# File lib/site-inspector/checks/whois.rb, line 10
def ip
  @ip ||= whois.lookup ip_address
end
to_h() click to toggle source
# File lib/site-inspector/checks/whois.rb, line 14
def to_h
  {
    domain: record_to_h(domain),
    ip: record_to_h(ip)
  }
end

Private Instance Methods

ip_address() click to toggle source
# File lib/site-inspector/checks/whois.rb, line 27
def ip_address
  @ip_address ||= Resolv.getaddress host
end
record_to_h(record) click to toggle source
# File lib/site-inspector/checks/whois.rb, line 23
def record_to_h(record)
  record.content.scan(/^\s*(.*?):\s*(.*?)\r?\n/).to_h
end
whois() click to toggle source
# File lib/site-inspector/checks/whois.rb, line 31
def whois
  @whois ||= ::Whois::Client.new
end