Sha256: 90abc301507531339306393df45e130f90a56c5d311dca53d9640d03df46eee0
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true module Mihari module Structs module BinaryEdge class Target < Dry::Struct # @!attribute [r] ip # @return [String] attribute :ip, Types::String class << self def from_dynamic!(d) d = Types::Hash[d] new( ip: d.fetch("ip") ) end end end class Event < Dry::Struct # @!attribute [r] target # @return [Target] attribute :target, Target class << self def from_dynamic!(d) d = Types::Hash[d] new( target: Target.from_dynamic!(d.fetch("target")) ) end end end class Response < Dry::Struct # @!attribute [r] page # @return [Integer] attribute :page, Types::Int # @!attribute [r] pagesize # @return [Integer] attribute :pagesize, Types::Int # @!attribute [r] total # @return [Integer] attribute :total, Types::Int # @!attribute [r] events # @return [Array<Event>] attribute :events, Types.Array(Event) # # @return [Array<Artifact>] # def artifacts events.map { |event| Models::Artifact.new(data: event.target.ip) } end class << self def from_dynamic!(d) d = Types::Hash[d] new( page: d.fetch("page"), pagesize: d.fetch("pagesize"), total: d.fetch("total"), events: d.fetch("events").map { |x| Event.from_dynamic!(x) } ) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.7.0 | lib/mihari/structs/binaryedge.rb |