Class: NameChecker::TwitterChecker

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

Constant Summary collapse

MAX_NAME_LENGTH =
16

Class Method Summary collapse

Methods included from Logging

infer_level, logger, #logger

Class Method Details

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



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/name_checker/twitter_checker.rb', line 13

def self.check(screen_name, options = {})
  # Just return false if the suggestion exceeds the max allowed SN length.
  if screen_name.length > MAX_NAME_LENGTH
    return Availability.new(@service_name, false)
  end

  # Carry on with the availability checking.
  options.merge!( query: { screen_name: screen_name } )
  res = get("/1/users/show.json", options)
  status = handle_response(res, screen_name)
  Availability.new(@service_name, status)
end

.warning_limitObject



26
27
28
# File 'lib/name_checker/twitter_checker.rb', line 26

def self.warning_limit
  20
end