lib/mihari/structs/greynoise.rb in mihari-5.6.2 vs lib/mihari/structs/greynoise.rb in mihari-5.7.0
- old
+ new
@@ -4,36 +4,23 @@
module Structs
module GreyNoise
class Metadata < Dry::Struct
include Mixins::AutonomousSystem
+ # @!attribute [r] country
+ # @return [String]
attribute :country, Types::String
+
+ # @!attribute [r] country_code
+ # @return [String]
attribute :country_code, Types::String
+
+ # @!attribute [r] asn
+ # @return [String]
attribute :asn, Types::String
#
- # @return [String]
- #
- def country
- attributes[:country]
- end
-
- #
- # @return [String]
- #
- def country_code
- attributes[:country_code]
- end
-
- #
- # @return [String]
- #
- def asn
- attributes[:asn]
- end
-
- #
# @return [Mihari::AutonomousSystem]
#
def as
Mihari::Models::AutonomousSystem.new(asn: normalize_asn(asn))
end
@@ -64,36 +51,23 @@
end
end
end
class Datum < Dry::Struct
+ # @!attribute [r] ip
+ # @return [String]
attribute :ip, Types::String
+
+ # @!attribute [r] metadata
+ # @return [Metadata]
attribute :metadata, Metadata
+
+ # @!attribute [r] metadata_
+ # @return [Hash]
attribute :metadata_, Types::Hash
#
- # @return [String]
- #
- def ip
- attributes[:ip]
- end
-
- #
- # @return [Metadata]
- #
- def metadata
- attributes[:metadata]
- end
-
- #
- # @return [Hash]
- #
- def metadata_
- attributes[:metadata_]
- end
-
- #
# @return [Mihari::Models::Artifact]
#
def artifact
Mihari::Models::Artifact.new(
data: ip,
@@ -119,57 +93,32 @@
end
end
end
class Response < Dry::Struct
+ # @!attribute [r] complete
+ # @return [Boolean]
attribute :complete, Types::Bool
+
+ # @!attribute [r] count
+ # @return [Integer]
attribute :count, Types::Int
+
+ # @!attribute [r] data
+ # @return [Array<Datnum>]
attribute :data, Types.Array(Datum)
+
+ # @!attribute [r] message
+ # @return [String]
attribute :message, Types::String
+
+ # @!attribute [r] query
+ # @return [String]
attribute :query, Types::String
- attribute :scroll, Types::String.optional
- #
- # @return [Boolean]
- #
- def complete
- attributes[:complete]
- end
-
- #
- # @return [Integer]
- #
- def count
- attributes[:count]
- end
-
- #
- # @return [Array<Datum>]
- #
- def data
- attributes[:data]
- end
-
- #
- # @return [String]
- #
- def message
- attributes[:message]
- end
-
- #
- # @return [String]
- #
- def query
- attributes[:query]
- end
-
- #
- # @return [String, nil]
- #
- def scroll
- attributes[:scroll]
- end
+ # @!attribute [r] scroll
+ # @return [String, nil]
+ attribute :scroll, Types::String.optional
#
# @return [Array<Mihari::Models::Artifact>]
#
def artifacts