Module: NameChecker

Defined in:
lib/name_checker/configuration.rb,
lib/name_checker.rb,
lib/name_checker/version.rb,
lib/name_checker/railties.rb,
lib/name_checker/net_checker.rb,
lib/name_checker/availability.rb,
lib/name_checker/whois_checker.rb,
lib/name_checker/twitter_checker.rb,
lib/name_checker/facebook_checker.rb,
lib/name_checker/robo_whois_checker.rb

Overview

NOTE: This is rate limited to 150 requests per hour. TODO: Add OAuth or some other authentication in order to get my request limit rate increased.

Defined Under Namespace

Classes: Availability, Configuration, FacebookChecker, NetChecker, Railties, RoboWhoisChecker, TwitterChecker, WhoisChecker

Constant Summary collapse

VERSION =
"0.0.15"

Class Method Summary collapse

Class Method Details

.check(text, service_name) ⇒ Object

Check the availability of a word on a specific service.

If the service name matches the identifier of a social network then that network will be checked. Otherwise, treat the service name as a top-level domain.

NameChecker.check('hello', 'twitter')

NameChecker.check('hello', 'com')

Returns an instance of the <tt>Availability<tt> class.



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/name_checker.rb', line 26

def self.check(text, service_name)
  # NOTE: Symbols are not good for detecting the service name.
  # Sometimes it might be 'co.uk'.
  case service_name
  when 'twitter' then TwitterChecker.check(text)
  when 'facebook' then FacebookChecker.check(text)
  # If not Twitter or Facebook then assume that the service
  # name is that of a TLD (like :com or :co.uk) and pass it to the
  # default net service checker.
  else NetChecker.check(text, service_name)
  end
end

.configurationObject



23
24
25
# File 'lib/name_checker/configuration.rb', line 23

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



27
28
29
# File 'lib/name_checker/configuration.rb', line 27

def self.configure
  yield configuration
end