Class: NameChecker::RoboWhoisChecker

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Logging
Defined in:
lib/name_checker/robo_whois_checker.rb

Defined Under Namespace

Classes: NoAPIKeyError

Class Method Summary collapse

Methods included from Logging

infer_level, logger, #logger

Class Method Details

.auth_optionsObject

NOTE: We can’t use the ‘basic_auth’ method because the configuration object is not available at the class level.



24
25
26
27
28
29
# File 'lib/name_checker/robo_whois_checker.rb', line 24

def self.auth_options
  # raise NoAPIKeyError unless NameChecker.configuration.robo_whois_api_key

  { password: 'X',
    username: NameChecker.configuration.robo_whois_api_key }
end

.check(host, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/name_checker/robo_whois_checker.rb', line 12

def self.check(host, options={})
  options.merge!(basic_auth: auth_options)

  res = get("/availability/#{host}", options)
  status = handle_response(res, host)
  Availability.new(@service_name, status)
rescue
  Availability.new(@service_name, 'unknown')
end

.warning_limitObject



31
32
33
# File 'lib/name_checker/robo_whois_checker.rb', line 31

def self.warning_limit
  50
end