Sha256: c3cc31957a2188b21d7c7ee39b2494632164e9b19e14a24a5e774880eb60cd22

Contents?: true

Size: 1.34 KB

Versions: 16

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

module Mihari
  module Structs
    module Alert
      class SearchFilter < Dry::Struct
        attribute? :artifact_data, Types::String.optional
        attribute? :description, Types::String.optional
        attribute? :source, Types::String.optional
        attribute? :tag_name, Types::String.optional
        attribute? :title, Types::String.optional
        attribute? :from_at, Types::DateTime.optional
        attribute? :to_at, Types::DateTime.optional
        attribute? :asn, Types::Int.optional
        attribute? :dns_record, Types::String.optional
        attribute? :reverse_dns_name, Types::String.optional

        def valid_artifact_filters?
          !(artifact_data || asn || dns_record || reverse_dns_name).nil?
        end
      end

      class SearchFilterWithPagination < SearchFilter
        attribute? :page, Types::Int.default(1)
        attribute? :limit, Types::Int.default(10)

        def without_pagination
          SearchFilter.new(
            artifact_data: artifact_data,
            description: description,
            from_at: from_at,
            source: source,
            tag_name: tag_name,
            title: title,
            to_at: to_at,
            asn: asn,
            dns_record: dns_record,
            reverse_dns_name: reverse_dns_name
          )
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mihari-4.7.1 lib/mihari/structs/alert.rb
mihari-4.7.0 lib/mihari/structs/alert.rb
mihari-4.6.1 lib/mihari/structs/alert.rb
mihari-4.6.0 lib/mihari/structs/alert.rb
mihari-4.5.3 lib/mihari/structs/alert.rb
mihari-4.5.2 lib/mihari/structs/alert.rb
mihari-4.5.1 lib/mihari/structs/alert.rb
mihari-4.5.0 lib/mihari/structs/alert.rb
mihari-4.4.1 lib/mihari/structs/alert.rb
mihari-4.4.0 lib/mihari/structs/alert.rb
mihari-4.3.0 lib/mihari/structs/alert.rb
mihari-4.2.0 lib/mihari/structs/alert.rb
mihari-4.1.2 lib/mihari/structs/alert.rb
mihari-4.1.1 lib/mihari/structs/alert.rb
mihari-4.1.0 lib/mihari/structs/alert.rb
mihari-4.0.0 lib/mihari/structs/alert.rb