Class: Mihari::Structs::GreyNoise::Datum

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Datum

Parameters:

  • d (Hash)

Returns:



112
113
114
115
116
117
118
119
# File 'lib/mihari/structs/greynoise.rb', line 112

def from_dynamic!(d)
  d = Types::Hash[d]
  new(
    ip: d.fetch("ip"),
    metadata: Metadata.from_dynamic!(d.fetch("metadata")),
    metadata_: d
  )
end

Instance Method Details

#ipString

Returns:

  • (String)


76
77
78
# File 'lib/mihari/structs/greynoise.rb', line 76

def ip
  attributes[:ip]
end

#metadataMetadata

Returns:



83
84
85
# File 'lib/mihari/structs/greynoise.rb', line 83

def 
  attributes[:metadata]
end

#metadata_Hash

Returns:

  • (Hash)


90
91
92
# File 'lib/mihari/structs/greynoise.rb', line 90

def 
  attributes[:metadata_]
end

#to_artifactMihari::Artifact

Returns:



97
98
99
100
101
102
103
104
# File 'lib/mihari/structs/greynoise.rb', line 97

def to_artifact
  Mihari::Artifact.new(
    data: ip,
    metadata: ,
    autonomous_system: .to_as,
    geolocation: .to_geolocation
  )
end