Sha256: 15123c3b6726be4d09cada08ea93a29f3b0c90c01d96b38f649a32ff093d362c

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Yoti
  module DocScan
    module Session
      module Create
        class RequiredIdDocument < RequiredDocument
          #
          # @param [DocumentFilter] filter
          #
          def initialize(filter = nil)
            super(Constants::ID_DOCUMENT)

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

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

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

        class RequiredIdDocumentBuilder
          #
          # @param [DocumentFilter] filter
          #
          # @return [self]
          #
          def with_filter(filter)
            @filter = filter
            self
          end

          #
          # @return [RequiredIdDocument]
          #
          def build
            RequiredIdDocument.new(@filter)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yoti-1.10.0 lib/yoti/doc_scan/session/create/required_id_document.rb
yoti-1.9.0 lib/yoti/doc_scan/session/create/required_id_document.rb
yoti-1.8.0 lib/yoti/doc_scan/session/create/required_id_document.rb
yoti-1.7.1 lib/yoti/doc_scan/session/create/required_id_document.rb
yoti-1.7.0 lib/yoti/doc_scan/session/create/required_id_document.rb