Sha256: c8981dbd6d074b15463e2b4d7dbccea3c2b06a6716cad97986e5c5589933ac8c

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module Yoti
  module Sandbox
    module DocScan
      module Request
        class DocumentCheck < Check
          #
          # @param [CheckResult] result
          # @param [DocumentFilter] document_filter
          #
          def initialize(result, document_filter)
            raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DocumentCheck)

            super(result)

            Validation.assert_is_a(DocumentFilter, document_filter, 'document_filter', true)
            @document_filter = document_filter
          end

          def as_json(*_args)
            json = super
            json[:document_filter] = @document_filter.as_json unless @document_filter.nil?
            json
          end
        end

        class DocumentCheckBuilder < CheckBuilder
          def initialize
            raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DocumentCheckBuilder)

            super
          end

          #
          # @param [DocumentFilter] document_filter
          #
          # @return [self]
          #
          def with_document_filter(document_filter)
            @document_filter = document_filter
            self
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yoti_sandbox-1.4.0 lib/yoti_sandbox/doc_scan/request/check/document_check.rb