Sha256: 6d67c70a19939e66148892f6f3d670490ab8fbfbb3f95d51b84fc3b913671586

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module Onfido
  class Document < Resource
    # with open-uri the file can be a link or an actual file

    def create(applicant_id:, file:, type:, **payload)
      validate_file!(file)
      payload[:applicant_id] = applicant_id
      payload[:file] = file
      payload[:type] = type

      post(path: 'documents', payload: payload)
    end

    def find(document_id)
      get(path: "documents/#{document_id}")
    end

    def download(document_id)
      get(path: "documents/#{document_id}/download")
    end

    def all(applicant_id)
      get(path: "documents?applicant_id=#{applicant_id}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
onfido-2.1.0 lib/onfido/resources/document.rb
onfido-2.0.2 lib/onfido/resources/document.rb
onfido-2.0.1 lib/onfido/resources/document.rb
onfido-2.0.0 lib/onfido/resources/document.rb