Sha256: b49aa57feff7d6e3f2b537af6833c559c624dc471dc8b1cc9814efc6fe1849f5

Contents?: true

Size: 1.84 KB

Versions: 16

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

module Mihari
  module Entities
    class Artifact < Grape::Entity
      expose :id, documentation: { type: Integer, required: true }
      expose :data, documentation: { type: String, required: true }
      expose :data_type, documentation: { type: String, required: true }, as: :dataType
      expose :source, documentation: { type: String, required: true }
      expose :tags, documentation: { type: String, is_array: true }

      expose :metadata, documentation: { type: Hash }

      expose :autonomous_system, using: Entities::AutonomousSystem, documentation: { type: Entities::AutonomousSystem, required: false }, as: :autonomousSystem
      expose :geolocation, using: Entities::Geolocation, documentation: { type: Entities::Geolocation, required: false }
      expose :whois_record, using: Entities::WhoisRecord, documentation: { type: Entities::WhoisRecord, required: false }, as: :whoisRecord

      expose :reverse_dns_names, using: Entities::ReverseDnsName, documentation: { type: Entities::ReverseDnsName, is_array: true, required: false }, as: :reverseDnsNames do |status, _options|
        status.reverse_dns_names.empty? ? nil : status.reverse_dns_names
      end
      expose :dns_records, using: Entities::DnsRecord, documentation: { type: Entities::DnsRecord, is_array: true, required: false }, as: :dnsRecords do |status, _options|
        status.dns_records.empty? ? nil : status.dns_records
      end
      expose :ceps, using: Entities::CPE, documentation: { type: Entities::CPE, is_array: true, required: false }, as: :cpes do |status, _options|
        status.cpes.empty? ? nil : status.cpes
      end
      expose :ports, using: Entities::Port, documentation: { type: Entities::Port, is_array: true, required: false }, as: :ports do |status, _options|
        status.ports.empty? ? nil : status.ports
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mihari-4.12.0 lib/mihari/entities/artifact.rb
mihari-4.11.0 lib/mihari/entities/artifact.rb
mihari-4.10.0 lib/mihari/entities/artifact.rb
mihari-4.9.0 lib/mihari/entities/artifact.rb
mihari-4.8.0 lib/mihari/entities/artifact.rb
mihari-4.7.4 lib/mihari/entities/artifact.rb
mihari-4.7.3 lib/mihari/entities/artifact.rb
mihari-4.7.2 lib/mihari/entities/artifact.rb
mihari-4.7.1 lib/mihari/entities/artifact.rb
mihari-4.7.0 lib/mihari/entities/artifact.rb
mihari-4.6.1 lib/mihari/entities/artifact.rb
mihari-4.6.0 lib/mihari/entities/artifact.rb
mihari-4.5.3 lib/mihari/entities/artifact.rb
mihari-4.5.2 lib/mihari/entities/artifact.rb
mihari-4.5.1 lib/mihari/entities/artifact.rb
mihari-4.5.0 lib/mihari/entities/artifact.rb