Class: Osakana::Enrichers::Enricher

Inherits:
Base
  • Object
show all
Defined in:
lib/osakana/enrichers/enricher.rb

Instance Method Summary collapse

Constructor Details

#initializeEnricher

Returns a new instance of Enricher.



6
7
8
# File 'lib/osakana/enrichers/enricher.rb', line 6

def initialize
  @enrichers = [SecurityTrails.new, Robtex.new]
end

Instance Method Details

#domain_to_ipv4(domain) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/osakana/enrichers/enricher.rb', line 19

def domain_to_ipv4(domain)
  @enrichers.each do |enricher|
    return enricher.domain_to_ipv4(domain)
  rescue ArgumentError, ::SecurityTrails::Error, ::Robtex::ResponseError => _
    next
  end
  nil
end

#ipv4_to_domain(ipv4) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/osakana/enrichers/enricher.rb', line 10

def ipv4_to_domain(ipv4)
  @enrichers.each do |enricher|
    return enricher.ipv4_to_domain(ipv4)
  rescue ArgumentError, ::SecurityTrails::Error, ::Robtex::ResponseError, URI::InvalidURIError => _
    next
  end
  nil
end