lib/mihari/structs/onyphe.rb in mihari-3.6.0 vs lib/mihari/structs/onyphe.rb in mihari-3.6.1
- old
+ new
@@ -4,19 +4,19 @@
module Mihari
module Structs
module Onyphe
class Result < Dry::Struct
attribute :asn, Types::String
- attribute :country_code, Types::String
+ attribute :country_code, Types::String.optional
attribute :ip, Types::String
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.fetch("country")
+ country_code: d["country"]
)
end
end
class Response < Dry::Struct