Class: Mihari::WhoisRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Mihari::WhoisRecord
- Defined in:
- lib/mihari/models/whois.rb
Class Method Summary collapse
-
.build_by_domain(domain) ⇒ WhoisRecord?
Build whois record.
Class Method Details
.build_by_domain(domain) ⇒ WhoisRecord?
Build whois record
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mihari/models/whois.rb', line 19 def build_by_domain(domain) domain = PublicSuffix.domain(domain) # check memo if @memo.key?(domain) whois_record = @memo[domain] # return clone of the record return whois_record.dup end record = Whois.whois(domain) parser = record.parser return nil if parser.available? whois_record = new( domain: domain, created_on: get_created_on(parser), updated_on: get_updated_on(parser), expires_on: get_expires_on(parser), registrar: get_registrar(parser), contacts: get_contacts(parser) ) # set memo @memo[domain] = whois_record whois_record rescue Whois::Error, Whois::ParserError, Timeout::Error nil end |