Class: Mihari::Structs::Onyphe::Result

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/mihari/structs/onyphe.rb

Class Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/mihari/structs/onyphe.rb', line 12

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    asn: d.fetch("asn"),
    ip: d.fetch("ip"),
    # Onyphe's country = 2-letter country code
    country_code: d["country"],
    metadata: d
  )
end