dimanche 22 mai 2016

Embed Hellosign signature in Refile PDF

I'm attempting to use the Hellosign API create an embedded signature request with a PDF that was created using pdfkit and stored/uploaded with Refile. Each contract is uniquely created for each signer, depending on the signer details.

I've followed the steps in this Ruby documentation and run into an error on the signatures_controller.rb.

# app/controllers/signatures_controller.rb

def create_embedded_request(opts = {})
    HelloSign.create_embedded_signature_request(
        test_mode: 1, #Set this to 1 for 'true'. 'false' is 0
        client_id: Settings.hellosign_client_id,
        subject: 'My first embedded signature request',
        message: 'Awesome, right?',
        signers: [
            {
               email_address: opts[:email],
               name: opts[:name]
            }
        ],
        files: ["#{Refile.attachment_url(@contract, :file, format: "pdf")}"]
    )
end

The documentation uses a gem hellosign-ruby-sdk which indicates that the filetype can be specified in these formats:

Specifying files (link here)

When using request endpoints that send files, such as a signature request, you can specify files either as

  1. A string representing the path
  2. A Ruby File Object (File.open, then assign to a variable)
  3. A Rails ActionDispatch::Http::UploadedFile

I have used the Refile attachment_url helper to generate (1) for the pdf in the code snippet above. But encountered this error:

HelloSign::Error::FileNotFound at /signatures

/attachments/e9ec551d339ed6ef62a882a30842c48dc8f25fa6/store/8d56484e3049813cc557e9f8fc628f68a0db1e76a76444890a2ddb2be54a/KL051610060 was not found on the filesystem

Am I understanding the API incorrectly? What am I doing wrong?

Thanks!!

Aucun commentaire:

Enregistrer un commentaire