lib/mihari/structs/greynoise.rb in mihari-3.12.0 vs lib/mihari/structs/greynoise.rb in mihari-4.0.0
- old
+ new
@@ -1,10 +1,7 @@
# frozen_string_literal: true
-require "json"
-require "dry/struct"
-
module Mihari
module Structs
module GreyNoise
class Metadata < Dry::Struct
attribute :country, Types::String
@@ -22,15 +19,17 @@
end
class Datum < Dry::Struct
attribute :ip, Types::String
attribute :metadata, Metadata
+ attribute :metadata_, Types::Hash
def self.from_dynamic!(d)
d = Types::Hash[d]
new(
ip: d.fetch("ip"),
- metadata: Metadata.from_dynamic!(d.fetch("metadata"))
+ metadata: Metadata.from_dynamic!(d.fetch("metadata")),
+ metadata_: d
)
end
end
class Response < Dry::Struct