Class: Mihari::Enrichers::MMDB
- Defined in:
- lib/mihari/enrichers/mmdb.rb
Overview
MMDB enricher
Constant Summary
Constants included from Concerns::Retriable
Concerns::Retriable::DEFAULT_CONDITION, Concerns::Retriable::RETRIABLE_ERRORS
Instance Attribute Summary
Attributes inherited from Actor
Instance Method Summary collapse
Methods inherited from Base
#callable?, inherited, #initialize, #result
Methods inherited from Actor
configuration_keys, #initialize, key, key_aliases, keys, #result, #retry_exponential_backoff, #retry_interval, #retry_times, #timeout, type, #validate_configuration!
Methods included from Concerns::Retriable
Methods included from Concerns::Configurable
#configuration_keys?, #configured?
Constructor Details
This class inherits a constructor from Mihari::Enrichers::Base
Instance Method Details
#call(artifact) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mihari/enrichers/mmdb.rb', line 12 def call(artifact) res = client.query(artifact.data) artifact.tap do |tapped| tapped.autonomous_system ||= Models::AutonomousSystem.new(number: res.asn) if res.asn if res.country_code tapped.geolocation ||= Models::Geolocation.new( country: NormalizeCountry(res.country_code, to: :short), country_code: res.country_code ) end end end |