Sha256: 3dca608495d0b57b6df35c644d598c86eb38475369ef3980c6bf3e2f138223ac
Contents?: true
Size: 531 Bytes
Versions: 27
Compression:
Stored size: 531 Bytes
Contents
# frozen_string_literal: true require "normalize_country" module Mihari class Geolocation < ActiveRecord::Base belongs_to :artifact class << self # # Build Geolocation # # @param [String] ip # # @return [Mihari::Geolocation, nil] # def build_by_ip(ip) res = Enrichers::IPInfo.query(ip) return nil if res&.country_code.nil? new(country: NormalizeCountry(res.country_code, to: :short), country_code: res.country_code) end end end end
Version data entries
27 entries across 27 versions & 1 rubygems