Class: Bulkdom::DomainList

Inherits:
Object
  • Object
show all
Defined in:
lib/bulkdom/domain_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDomainList

Returns a new instance of DomainList.



5
6
7
8
# File 'lib/bulkdom/domain_list.rb', line 5

def initialize()
  @list, @tlds = ["example"], [".com"]
  @processed = false
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



3
4
5
# File 'lib/bulkdom/domain_list.rb', line 3

def list
  @list
end

#processedObject

Returns the value of attribute processed.



3
4
5
# File 'lib/bulkdom/domain_list.rb', line 3

def processed
  @processed
end

#resultsObject

Returns the value of attribute results.



3
4
5
# File 'lib/bulkdom/domain_list.rb', line 3

def results
  @results
end

#tldsObject

Returns the value of attribute tlds.



3
4
5
# File 'lib/bulkdom/domain_list.rb', line 3

def tlds
  @tlds
end

Instance Method Details

#processObject



10
11
12
13
# File 'lib/bulkdom/domain_list.rb', line 10

def process
  self.results = whois_check(dns_record_check(generate_results_hash(self.list, self.tlds), self.tlds), self.tlds)
  self.processed = true
end

#return_available(tld) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bulkdom/domain_list.rb', line 15

def return_available(tld)
  process unless self.processed
  
  available_domains = []
  
  self.results.each do |i|
    available_domains << "#{i[:domain]}#{tld}" if i[:tlds]["#{tld.split('.')[1]}_available"] == "y"
  end
  
  return available_domains
end