class BitterDomain::DomainMapper

Attributes

checker[RW]
domain[R]
shifted_domains[R]

Public Class Methods

new(domain) click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 9
def initialize(domain)
  @domain = parse_domain(domain)
  @checker = nil
  @shifted_domains = []
end

Public Instance Methods

check_domains(attempt_retry=false) click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 32
def check_domains(attempt_retry=false)
  self.checker = BitterDomain::DomainChecker.new(@shifted_domains)
  self.checker.test_domains
  
  self.checker.retry if attempt_retry

  self.checker.available
end
domain=(domain) click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 27
def domain=(domain)
  self.domain = parse_domain(domain)
  gen_shifts
end
gen_shifts() click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 15
def gen_shifts
  host = @domain.sld
  shifter = BitterDomain::BitShifter.new(host)
  self.checker = nil
  @shifted_domains = shifter.get_shifted_domains
    .map { |dom| "#{dom}.#{@domain.tld}" }
end
get_available() click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 41
def get_available
  self.checker.available
end
get_errors() click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 45
def get_errors
  self.checker.errors
end
get_tested() click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 49
def get_tested
  self.checker.tested
end
print_available() click to toggle source
print_shifts() click to toggle source
print_verbose() click to toggle source
query_shifts() click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 66
def query_shifts
  gen_shifts
  check_domains

  get_available
end
retry() click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 53
def retry
  self.checker.retry
end

Protected Instance Methods

parse_domain(url) click to toggle source
# File lib/bitter_domain/domain_mapper.rb, line 77
def parse_domain(url)
  uri = URI.parse(url)
  uri = URI.parse("http://#{url}") if uri.scheme.nil?
  host = uri.host.downcase

  PublicSuffix.parse(host)
end