Sha256: ead94428c040306852cfa8c3a3624b692385edc747182dc144d05c8c5c0078c1

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

module Yoti
  module Sandbox
    module DocScan
      module Request
        class IdDocumentComparisonCheck < Check
          #
          # @param [CheckResult] result
          # @param [DocumentFilter] secondary_document_filter
          #
          def initialize(result, secondary_document_filter)
            super(result)

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

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

          #
          # @return [IdDocumentComparisonCheckBuilder]
          #
          def self.builder
            IdDocumentComparisonCheckBuilder.new
          end
        end

        class IdDocumentComparisonCheckBuilder < CheckBuilder
          #
          # @param [DocumentFilter] secondary_document_filter
          #
          # @return [self]
          #
          def with_secondary_document_filter(secondary_document_filter)
            @secondary_document_filter = secondary_document_filter
            self
          end

          #
          # @return [IdDocumentComparisonCheck]
          #
          def build
            report = CheckReport.new(@recommendation, @breakdowns)
            result = CheckResult.new(report)
            IdDocumentComparisonCheck.new(result, @secondary_document_filter)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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