Sha256: 263f4dcd6a9905c52da4caf64ab93e305646c1fa04afe3bb4dfcd2fc4968670c
Contents?: true
Size: 743 Bytes
Versions: 1
Compression:
Stored size: 743 Bytes
Contents
# frozen_string_literal: true module Mihari module Models class AutonomousSystem < ActiveRecord::Base belongs_to :artifact class << self include Dry::Monads[:result] # # Build AS # # @param [String] ip # @param [Mihari::Enrichers::IPInfo] enricher # # @return [Mihari::AutonomousSystem, nil] # def build_by_ip(ip, enricher: Enrichers::IPInfo.new) result = enricher.query_result(ip).bind do |res| value = res&.asn if value.nil? Success nil else Success new(asn: value) end end result.value_or nil end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.6.2 | lib/mihari/models/autonomous_system.rb |