Sha256: fb0b4052aa11983f64be04398b60899ffa9f97c6f734046259e16d42261997b2

Contents?: true

Size: 1.25 KB

Versions: 4

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 self.class == 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 self.class == 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

4 entries across 4 versions & 1 rubygems

Version Path
yoti_sandbox-1.3.0 lib/yoti_sandbox/doc_scan/request/check/document_check.rb
yoti_sandbox-1.2.1 lib/yoti_sandbox/doc_scan/request/check/document_check.rb
yoti_sandbox-1.2.0 lib/yoti_sandbox/doc_scan/request/check/document_check.rb
yoti_sandbox-1.1.0 lib/yoti_sandbox/doc_scan/request/check/document_check.rb