Sha256: 8fe4f5d2bd4aab189791f267005c96fbf519f03289513442e1a9ad2e46d63240

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

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

    def create(applicant_id, payload)
      validate_file!(payload.fetch(:file))

      post(
        url: url_for("applicants/#{applicant_id}/documents"),
        payload: payload
      )
    end

    def find(applicant_id, document_id)
      get(url: url_for("applicants/#{applicant_id}/documents/#{document_id}"))
    end

    def download(applicant_id, document_id)
      get(url: url_for("applicants/#{applicant_id}/documents/#{document_id}/download"))
    end

    def all(applicant_id)
      get(url: url_for("applicants/#{applicant_id}/documents"))
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
onfido-0.15.1 lib/onfido/resources/document.rb
onfido-0.15.0 lib/onfido/resources/document.rb
onfido-0.14.0 lib/onfido/resources/document.rb
onfido-0.13.0 lib/onfido/resources/document.rb
onfido-0.12.0 lib/onfido/resources/document.rb
onfido-0.11.0 lib/onfido/resources/document.rb
onfido-0.10.0 lib/onfido/resources/document.rb
onfido-0.9.0 lib/onfido/resources/document.rb