Sha256: 6a6a60b2c86ccc9669fef163adcf30de0487c57c58df2ad089cf1a8655803d82
Contents?: true
Size: 567 Bytes
Versions: 12
Compression:
Stored size: 567 Bytes
Contents
# frozen_string_literal: true require "active_record" 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) unless res.nil? return new(country: NormalizeCountry(res.country_code, to: :short), country_code: res.country_code) end nil end end end end
Version data entries
12 entries across 12 versions & 1 rubygems