Class: Mihari::Services::GeolocationBuilder
- Inherits:
-
Mihari::Service
- Object
- Mihari::Service
- Mihari::Services::GeolocationBuilder
- Defined in:
- lib/mihari/services/builders.rb
Overview
Geolocation builder
Instance Method Summary collapse
-
#call(ip, enricher: Enrichers::MMDB.new) ⇒ Mihari::Models::Geolocation?
Build Geolocation.
Methods inherited from Mihari::Service
Instance Method Details
#call(ip, enricher: Enrichers::MMDB.new) ⇒ Mihari::Models::Geolocation?
Build Geolocation
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/mihari/services/builders.rb', line 91 def call(ip, enricher: Enrichers::MMDB.new) enricher.result(ip).fmap do |res| if res.country_code Models::Geolocation.new( country: NormalizeCountry(res.country_code, to: :short), country_code: res.country_code ) end end.value_or nil end |