Module: Whois

Defined in:
lib/whois.rb,
lib/whois/client.rb,
lib/whois/errors.rb,
lib/whois/record.rb,
lib/whois/server.rb,
lib/whois/version.rb,
lib/whois/record/part.rb,
lib/whois/server/adapters/web.rb,
lib/whois/server/adapters/arin.rb,
lib/whois/server/adapters/arpa.rb,
lib/whois/server/adapters/base.rb,
lib/whois/server/adapters/none.rb,
lib/whois/server/socket_handler.rb,
lib/whois/server/adapters/afilias.rb,
lib/whois/server/adapters/standard.rb,
lib/whois/server/adapters/verisign.rb,
lib/whois/server/adapters/formatted.rb,
lib/whois/server/adapters/not_implemented.rb

Defined Under Namespace

Classes: AllocationUnknown, Client, ConnectionError, Error, InterfaceNotSupported, NoInterfaceError, Record, Server, ServerError, ServerNotFound, ServerNotImplemented, ServerNotSupported, WebInterfaceError

Constant Summary collapse

VERSION =

The current library version.

"5.1.1"

Class Method Summary collapse

Class Method Details

.available?(object) ⇒ Boolean

Deprecated.

Returns:

  • (Boolean)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/whois.rb', line 44

def available?(object)
  unless defined? Whois::Parser
    warn("Whois.available? requires the gem `whois-parser`")
    return false
  end

  deprecate(%{Whois.available? is deprecated. Call Whois.whois("#{object}").parser.available?})

  result = lookup(object).parser.available?
  if result.nil?
    warn  "This method is not supported for this kind of object.\n" \
          "Use Whois.lookup('#{object}') instead."
  end
  result
end

.bug!(error, message) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Appends Please report issue to to the message and raises a new error with the final message.

Parameters:

  • error (Exception)
  • message (String)

Raises:

  • (error)


91
92
93
94
95
# File 'lib/whois.rb', line 91

def bug!(error, message)
  raise error, message.dup <<
               " Please report the issue at " \
               "http://github.com/weppos/whois/issues"
end

.deprecate(message = nil, callstack = caller) ⇒ Object



77
78
79
80
# File 'lib/whois.rb', line 77

def deprecate(message = nil, callstack = caller)
  # warn("DEPRECATION WARNING: #{message} #{deprecation_caller_message(callstack)}")
  warn("DEPRECATION WARNING: #{message}")
end

.lookup(object) ⇒ Whois::Record Also known as: whois

Queries the WHOIS server for object and returns the response from the server.

Examples:

Whois.lookup("google.com")
# => #<Whois::Record>

# Equivalent to
Whois::Client.new.lookup("google.com")

Parameters:

  • object (String)

    The string to be sent as query parameter.

Returns:

  • (Whois::Record)

    The record containing the response from the WHOIS server.



36
37
38
# File 'lib/whois.rb', line 36

def lookup(object)
  Client.new.lookup(object)
end

.registered?(object) ⇒ Boolean

Deprecated.

Returns:

  • (Boolean)


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/whois.rb', line 61

def registered?(object)
  unless defined? Whois::Parser
    warn("Whois.registered? requires the gem `whois-parser`")
    return false
  end

  deprecate(%{Whois.registered? is deprecated. Call Whois.whois("#{object}").parser.registered?})

  result = lookup(object).parser.registered?
  if result.nil?
    warn  "This method is not supported for this kind of object.\n" \
          "Use Whois.lookup('#{object}') instead."
  end
  result
end