Sha256: 31e7392beadc1ec3675c64379097b4bf87f8ca9d038b26dab6a58523bde342b1

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module Osakana
  module Enrichers
    class Enricher < Base
      def initialize
        @enrichers = [SecurityTrails.new, Robtex.new]
      end

      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

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
osakana-0.4.0 lib/osakana/enrichers/enricher.rb
osakana-0.3.0 lib/osakana/enrichers/enricher.rb