Class: Whois::Domain::VerisignGrs

Inherits:
Base
  • Object
show all
Defined in:
lib/whois/domain/verisign_grs.rb

Direct Known Subclasses

Jobs

Constant Summary collapse

HOST =
"whois.verisign-grs.com"
ATTR_MATCH =
/^   ([^:]+):\W*(.*)$/
DATABASE_UPDATED_AT_REGEXES =
[
  /Last update of whois database: ([^<]*)/i,
  /Record last updated on ([^\.]*)/i
]

Constants inherited from Base

Base::ATTR_NAMES

Instance Attribute Summary

Attributes inherited from Base

#name, #raw

Instance Method Summary collapse

Methods inherited from Base

#administrative_id, #attrs, #created_on, #expired?, #expires_on, #lookup_restricted?, #name_servers, #ns, #register_url, #registered?, #registrar_name, responds_to, #status, #to_s, #updated_on, #whois_server

Constructor Details

#initialize(name) ⇒ VerisignGrs

Returns a new instance of VerisignGrs.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/whois/domain/verisign_grs.rb', line 6

def initialize(name)
  @name = name
  @host = nil

  query

  # Requery if the whois_server is different from HOST (or whois.iana.org
  # which doesn't appear to return much data). Check that the whois_server
  # does in fact return data before using.
  unless ( whois_server.empty? || [HOST, 'whois.iana.org'].include?(whois_server) )
    @host = whois_server
    old_raw = @raw
    query
    @raw = old_raw if (@raw =~ /not available/)
  end
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/whois/domain/verisign_grs.rb', line 56

def available?
  @raw =~ /^No match for/
end

#database_updated_atObject



46
47
48
49
50
51
52
53
54
# File 'lib/whois/domain/verisign_grs.rb', line 46

def database_updated_at
  DATABASE_UPDATED_AT_REGEXES.each do |regex|
    if (match_data = @raw.match(regex))
      return Time.parse(match_data[1])
    end
  end

  return nil
end

#hostObject



23
24
25
26
27
28
29
30
31
# File 'lib/whois/domain/verisign_grs.rb', line 23

def host
  return @host unless @host.nil?

  case @name.match(/.*\.([^\.]+)$/)[1]
    when 'jobs' then "jobswhois.verisign-grs.com"
    when 'tv'   then "tvwhois.verisign-grs.com"
    else             "whois.verisign-grs.com"
  end
end

#query_stringObject



33
34
35
36
37
38
39
# File 'lib/whois/domain/verisign_grs.rb', line 33

def query_string
  if host == "whois.verisign-grs.com"
    "domain #{@name.upcase}\n"
  else
    "#{@name.upcase}\n"
  end
end

#registrant_idObject



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/whois/domain/verisign_grs.rb', line 60

def registrant_id
  found = false
  @raw.each_line do |l|
    if l =~ /^Organisation Contact/
      found = true
    elsif found && l =~ /^ID\.+:\s+(.+)/
      return $1
    end
  end
  ''
end