Module: HelloSign::Api::UnclaimedDraft

Included in:
Client
Defined in:
lib/hello_sign/api/unclaimed_draft.rb

Overview

Contains all the api calls for the UnclaimedDraft resource. Take a look at our unclaimed draft document for more information about this.

Author:

  • hellosign

Instance Method Summary collapse

Instance Method Details

#create_embedded_unclaimed_draft(opts) ⇒ HelloSign::Resource::UnclaimedDraft

Creates a new embedded unclaimed draft object that can be launched in an iframe using the claim URL.

Examples:

request_signature

unclaimed_draft = @client.create_embedded_unclaimed_draft(
  :test_mode => 1,
  :type => 'request_signature',
  :subject => 'The NDA we talked about',
  :requester_email_address => [email protected]",
  :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
  :metadata => {
   :client_id => '1234',
   :custom_text => 'NDA #9'
  },
  :signers => [{
      :email_address => '[email protected]',
      :name => 'Jack',
      :order => 0
    },{
      :email_address => '[email protected]',
      :name => 'Jill',
      :order => 1
    }
  ],
  :cc_email_addresses => ['[email protected]', '[email protected]'],
  :files => ['NDA.pdf', 'AppendixA.pdf']
)

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • test_mode (Integer) — default: 0

    Whether this is a test, the signature request will not be legally binding if set to 1.

  • is_for_embedded_signing (Integer)

    set this to 1 to to mix embedded requesting and embedded signing.

  • files (Array<String>)

    Use files to indicate the uploaded file(s) to send for signature. Currently we only support use of either the files parameter or file_urls parameter, not both.

  • file_urls (Array<String>)

    Use file_urls to have HelloSign download the file(s) to send for signature. Currently we only support use of either the files parameter or file_urls parameter, not both.

  • type (String)

    The type of unclaimed draft to create. Should be “request_signature” for a claimable signature request. If the type is “request_signature” then signers name and email_address are not optional.

  • subject (String)

    The subject in the email that will be sent to the signers.

  • requester_email_address (String)

    The email address of the requester.

  • message (String)

    The custom message in the email that will be sent to the signers.

  • signing_redirect_url (String)

    The URL you want the signer redirected to after they successfully sign. (optional)

  • signers (Array<Hash>)

    List of signers, each item is a Hash with these keys:

    • :name (String) Sender’ name

    • :email_address (String) Sender’s email address

    • :order (Integer) The order the signer is required to sign in (optional)

    • :pin (Integer) The 4-digit code that will secure this signer’s signature page. You must have a business plan to use this feature. (optional)

  • cc_email_addresses (Array<String>)

    The email addresses that should be CCed.

Returns:



146
147
148
149
150
151
152
153
154
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 146

def create_embedded_unclaimed_draft(opts)
  opts[:client_id] ||= self.client_id
  prepare_files opts
  if opts[:type] == 'request_signature'
    prepare_signers opts
  end

  HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded', :body => opts)
end

#create_embedded_unclaimed_draft_with_template(opts) ⇒ HelloSign::Resource::UnclaimedDraft

Creates a new embedded unclaimed draft object from a template that can be launched in an iframe using the claim URL.

Examples:

request_signature

unclaimed_draft = @client.create_embedded_unclaimed_draft_with_template(
  :test_mode => 1,
  :subject => 'The NDA we talked about',
  :template_id => 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
  :requester_email_address => [email protected]",
  :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
  :metadata => {
   :client_id => '1234',
   :custom_text => 'NDA #9'
  },
   :signers => [
    {
      :email_address => '[email protected]',
      :name => 'George',
      :role => 'Client'
    }
  ],
  :ccs => [
    {
      :email_address =>'[email protected]',
      :role => "Accounting"
    }
  ],
  :custom_fields => {
    :Cost => '$20,000'
  }
)

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • test_mode (Integer) — default: 0

    Whether this is a test, the signature request will not be legally binding if set to 1.

  • subject (String)

    The subject in the email that will be sent to the signers.

  • requester_email_address (String)

    The email address of the requester.

  • message (String)

    The custom message in the email that will be sent to the signers.

  • signing_redirect_url (String)

    The URL you want the signer redirected to after they successfully sign. (optional)

  • signers (Array<Hash>)

    List of signers, each item is a Hash with these keys:

    • :name (String) Sender’ name

    • :email_address (String) Sender’s email address

    • :order (Integer) The order the signer is required to sign in (optional)

    • :pin (Integer) The 4-digit code that will secure this signer’s signature page. You must have a business plan to use this feature. (optional)

  • cc_email_addresses (Array<String>)

    The email addresses that should be CCed.

Returns:



203
204
205
206
207
208
209
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 203

def create_embedded_unclaimed_draft_with_template(opts)
  opts[:client_id] ||= self.client_id
  prepare_signers opts
  prepare_ccs opts
  prepare_templates opts
  HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded_with_template', :body => opts)
end

#create_unclaimed_draft(opts) ⇒ HelloSign::Resource::UnclaimedDraft

Creates a new Draft that can be claimed using the claim URL. The first authenticated user to access the URL will claim the Draft and will be shown either the “Sign and send” or the “Request signature” page with the Draft loaded. Subsequent access to the claim URL will result in a 404 not found. If the type is “send_document” then only the file parameter is required. If the type is “request_signature”, then the identities of the signers and optionally the location of signing elements on the page are also required.

Examples:

send_document

unclaimed_draft = @client.create_unclaimed_draft(
  :test_mode => 1,
  :files => ['NDA.pdf', 'AppendixA.pdf']
)

request_signature

unclaimed_draft = @client.create_unclaimed_draft(
  :test_mode => 1,
  :type => 'request_signature',
  :subject => 'The NDA we talked about',
  :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
  :metadata => {
   :client_id => '1234',
   :custom_text => 'NDA #9'
  },
  :signers => [{
      :email_address => '[email protected]',
      :name => 'Jack',
      :order => 0
    },{
      :email_address => '[email protected]',
      :name => 'Jill',
      :order => 1
    }
  ],
  :cc_email_addresses => ['[email protected]', '[email protected]'],
  :files => ['NDA.pdf', 'AppendixA.pdf']
)

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • test_mode (Integer) — default: 0

    Whether this is a test, the signature request will not be legally binding if set to 1.

  • files (Array<String>)

    Use files to indicate the uploaded file(s) to send for signature. Currently we only support use of either the files parameter or file_urls parameter, not both.

  • file_urls (Array<String>)

    Use file_urls to have HelloSign download the file(s) to send for signature. Currently we only support use of either the files parameter or file_urls parameter, not both.

  • type (String)

    The type of unclaimed draft to create. Use “send_document” to create a claimable file, and “request_signature” for a claimable signature request. If the type is “request_signature” then signers name and email_address are not optional.

  • subject (String)

    The subject in the email that will be sent to the signers.

  • message (String)

    The custom message in the email that will be sent to the signers.

  • signing_redirect_url (String)

    The URL you want the signer redirected to after they successfully sign. (optional)

  • signers (Array<Hash>)

    List of signers, each item is a Hash with these keys:

    • :name (String) Sender’ name

    • :email_address (String) Sender’s email address

    • :order (Integer) The order the signer is required to sign in (optional)

    • :pin (Integer) The 4-digit code that will secure this signer’s signature page. You must have a business plan to use this feature. (optional)

  • cc_email_addresses (Array<String>)

    The email addresses that should be CCed.

  • form_fields_per_document (String)

Returns:



91
92
93
94
95
96
97
98
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 91

def create_unclaimed_draft opts
  prepare_files opts
  if opts[:type] == 'request_signature'
    prepare_signers opts
  end

  HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create', :body => opts)
end