Sha256: eff7e6adef4f1773d5b35207b3c41f0a4032cb6e970136f53a2387cde18587c8
Contents?: true
Size: 877 Bytes
Versions: 4
Compression:
Stored size: 877 Bytes
Contents
# frozen_string_literal: true module Mihari module Structs module IPInfo class Response < Dry::Struct attribute :ip, Types::String attribute :hostname, Types::String.optional attribute :loc, Types::String attribute :country_code, Types::String attribute :asn, Types::Integer.optional class << self include Mixins::AutonomousSystem def from_dynamic!(d) d = Types::Hash[d] asn = nil asn_ = d.dig("asn", "asn") unless asn_.nil? asn = normalize_asn(asn_) end new( ip: d.fetch("ip"), loc: d.fetch("loc"), hostname: d["hostname"], country_code: d.fetch("country"), asn: asn ) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mihari-4.1.2 | lib/mihari/structs/ipinfo.rb |
mihari-4.1.1 | lib/mihari/structs/ipinfo.rb |
mihari-4.1.0 | lib/mihari/structs/ipinfo.rb |
mihari-4.0.0 | lib/mihari/structs/ipinfo.rb |