Class: Mihari::Structs::IPInfo::Response
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::IPInfo::Response
- Extended by:
- Mixins::AutonomousSystem
- Defined in:
- lib/mihari/structs/ipinfo.rb
Class Method Summary collapse
Methods included from Mixins::AutonomousSystem
Class Method Details
.from_dynamic!(d) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mihari/structs/ipinfo.rb', line 16 def from_dynamic!(d) d = d.deep_stringify_keys d = Types::Hash[d] asn = nil asn_ = d.dig("asn", "asn") asn = normalize_asn(asn_) unless asn_.nil? new( ip: d.fetch("ip"), loc: d["loc"], hostname: d["hostname"], country_code: d["country"], asn: asn ) end |