lib/onfido/resources/document.rb in onfido-0.15.1 vs lib/onfido/resources/document.rb in onfido-1.0.0
- old
+ new
@@ -1,26 +1,26 @@
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))
+ def create(applicant_id:, file:, type:, **payload)
+ validate_file!(file)
+ payload[:applicant_id] = applicant_id
+ payload[:file] = file
+ payload[:type] = type
- post(
- url: url_for("applicants/#{applicant_id}/documents"),
- payload: payload
- )
+ post(path: 'documents', payload: payload)
end
- def find(applicant_id, document_id)
- get(url: url_for("applicants/#{applicant_id}/documents/#{document_id}"))
+ def find(document_id)
+ get(path: "documents/#{document_id}")
end
- def download(applicant_id, document_id)
- get(url: url_for("applicants/#{applicant_id}/documents/#{document_id}/download"))
+ def download(document_id)
+ get(path: "documents/#{document_id}/download")
end
def all(applicant_id)
- get(url: url_for("applicants/#{applicant_id}/documents"))
+ get(path: "documents?applicant_id=#{applicant_id}")
end
end
end