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 API documentation for creating UnclaimedDrafts (app.hellosign.com/api/reference#UnclaimedDraft) 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 UnclaimedDraft 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 (Boolean)

    Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. A boolean value is also accepted. Defaults to 0. (optional)

  • client_id (String)

    The API App Client ID associated with the UnclaimedDraft.

  • files (Array<String>)

    Specified file path(s) to upload 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>)

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

  • requester_email_address (String)

    The email address of the requester, if “request_signature” type.

  • type (String)

    The type of UnclaimedDraft to create. Use “send_document” to create a claimable file, and “request_signature” for a claimable signature request.

    • For “send_document,” only the file parameter is required.

    • For “request_signature,” then signer name and email_address are required.

  • subject (String)

    The subject in the email that will be sent to the signer(s). (optional)

  • message (String)

    The custom message in the email that will be sent to the signer(s). (optional)

  • signers (Array<Hash>)

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

    • :name (String) Signer’s name

    • :email_address (String) Signer’s email address

    • :order (Integer) The order the signers are required to sign in (optional)

  • cc_email_addresses (Array<String>)

    The email addresses that should be CCed. (optional)

  • signing_redirect_url (String)

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

  • custom_fields (Array<Hash>)

    An array of custom merge fields, representing those present on the document with Text Tags or form_fields_per_document (optional)

    • :name (String) Custom field name or “Field Label”

    • :value (String) The value of the field. This data will appear on the SignatureRequest.

  • use_text_tags (Boolean)

    Indicates whether the SignatureRequest should have Text Tags enabled. Defaults to 0. (optional)

  • hide_text_tags (Boolean)

    Indicates whether the Text Tags should be removed automatically. Note that this is not the preferred method. Defaults to 0. (optional)

  • use_preexisting_fields (Boolean)

    Sets the detection of predefined PDF fields. Defaults to 0. (optional)

  • is_for_embedded_signing (Boolean)

    Enable the UnclaimedDraft to be used for an Embedded SignatureRequest. Defaults to 0. (optional)

  • skip_me_now (Boolean)

    Disables the “Me (Now)” option for the preparer. Not available for type “send_document.” Defaults to 0. (optional)

  • metadata (Hash)

    Key-value data attached to the SignatureRequest. (optional)

  • allow_decline (Boolean)

    Allows signers to decline the SignatureRequest. Defaults to 0. (optional)

  • allow_reassign (Boolean)

    Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)

  • form_fields_per_document (Array<Hash>)

    The fields that should appear on the document. (optional)

Returns:



167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 167

def create_embedded_unclaimed_draft(opts)
  opts[:client_id] ||= self.client_id
  prepare_files opts
  prepare_form_fields opts
  prepare_custom_fields opts

  if opts[:type] == 'request_signature' || opts[:type] == 'send_document'
    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 UnclaimedDraft 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.',
  :files => ['NDA.pdf', 'AppendixA.pdf'],
  :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 (Boolean)

    Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. A boolean value is also accepted. Defaults to 0. (optional)

  • client_id (String)

    The API App Client ID associated with the UnclaimedDraft.

  • template_id (String)

    The Template ID to use when creating the UnclaimedDraft.

    • Use template_ids if using multiple templates, replacing %i% with an integer to indicate the order of the Templates

  • requester_email_address (String)

    The email address of the requester, if “request_signature” type.

  • title (String)

    The title you want to assign to the SignatureRequest. (optional)

  • subject (String)

    The subject in the email that will be sent to the signer(s). (optional)

  • message (String)

    The custom message in the email that will be sent to the signer(s). (optional)

  • signers (Array<Hash>)

    List of signers

    • :role (String) The signer role indicated on the Template. Note that the role name is case sensitive.

    • :name (String) Signer’s name

    • :email_address (String) Signer’s email address

  • ccs (Array<Hash>)

    The individual(s) to be CC’d on the SignatureRequest. Required when a CC role exists for the Template.

    • :role (String) The CC role indicated on the Template. Note that the role name is case sensitive.

    • :email_address (String) CC Recipient’s email address

  • signing_redirect_url (String)

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

  • requesting_redirect_url (String)

    The URL you want the requester redirected to after they successfully request a SignatureRequest. (optional)

  • metadata (Hash)

    Key-value data attached to the SignatureRequest. (optional)

  • custom_fields (Array<Hash>)

    An array of custom merge fields, representing those present in the Template. (optional)

    • :name (String) Custom field name or “Field Label”

    • :value (String) The value of the field. This data will appear on the SignatureRequest.

  • files (Array<String>)

    Use files to indicate the uploaded file(s) to append to the SignatureRequest. (optional)

  • file_urls (Array<String>)

    Use file_urls to have HelloSign download the file(s) to append to the SignatureRequest. (optional)

  • skip_me_now (Boolean)

    Disables the “Me (Now)” option for the preparer. Not available for type “send_document.” Defaults to 0. (optional)

  • allow_decline (Boolean)

    Allows signers to decline the SignatureRequest. Defaults to 0. (optional)

  • allow_reassign (Boolean)

    Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)

Returns:



241
242
243
244
245
246
247
248
249
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 241

def create_embedded_unclaimed_draft_with_template(opts)
  opts[:client_id] ||= self.client_id
  prepare_signers opts
  prepare_custom_fields opts
  prepare_ccs opts
  prepare_templates opts
  prepare_files 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 UnclaimedDraft that can be claimed using the claim_url. The first authenticated user to access the claim_url claims 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 error.

Examples:

type: send_document

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

type: 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 (Boolean)

    Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. A boolean value is also accepted. Defaults to 0. (optional)

  • files (Array<String>)

    Specified file path(s) to upload 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>)

    URL(s) for HelloSign to 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 UnclaimedDraft to create. Use “send_document” to create a claimable file, and “request_signature” for a claimable signature request.

    • For “send_document,” only the file parameter is required.

    • For “request_signature,” then signer name and email_address are required.

  • subject (String)

    The subject in the email that will be sent to the signer(s). (optional)

  • message (String)

    The custom message in the email that will be sent to the signer(s). (optional)

  • signers (Array<Hash>)

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

    • :name (String) Signer’s name

    • :email_address (String) Signer’s email address

    • :order (Integer) The order the signers are required to sign in (optional)

  • custom_fields (Array<Hash>)

    An array of custom merge fields, representing those present on the document with Text Tags or form_fields_per_document (optional)

    • :name (String) Custom field name or “Field Label”

    • :value (String) The value of the field. This data will appear on the SignatureRequest.

  • cc_email_addresses (Array<String>)

    The email addresses that should be CCed. (optional)

  • signing_redirect_url (String)

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

  • use_text_tags (Boolean)

    Indicates whether the SignatureRequest should have Text Tags enabled. Defaults to 0. (optional)

  • hide_text_tags (Boolean)

    Indicates whether the Text Tags should be removed automatically. Note that this is not the preferred method. Defaults to 0. (optional)

  • use_preexisting_fields (Boolean)

    Sets the detection of predefined PDF fields. Defaults to 0. (optional)

  • metadata (Hash)

    Key-value data attached to the SignatureRequest. (optional)

  • allow_decline (Boolean)

    Allows signers to decline the SignatureRequest. Defaults to 0. (optional)

  • allow_reassign (Boolean)

    Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)

  • form_fields_per_document (Array<Hash>)

    The fields that should appear on the document. (optional)

Returns:



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 97

def create_unclaimed_draft opts
  prepare_files opts
  prepare_form_fields opts
  prepare_custom_fields opts

  if opts[:type] == 'request_signature'
    prepare_signers opts
  end

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

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

Creates a new SignatureRequest from an Embedded UnclaimedDraft. This UnclaimedDraft can be edited using the claim_url.

Examples:

unclaimed_draft = @client.edit_and_resend_unclaimed_draft(
  :signature_request_id => '75cdf7dc8b323d43b347e4a3614d1f822bd09491',
  :test_mode => 1,
  :client_id => 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
)

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • signature_request_id (String)

    The SignatureRequest ID to edit and resend.

  • client_id (String)

    The API App Client ID associated with the UnclaimedDraft.

  • test_mode (Boolean)

    Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. A boolean value is also accepted. Defaults to 0. (optional)

  • requesting_redirect_url (String)

    The URL you want the requester redirected to after they successfully request a SignatureRequest. (optional)

  • signing_redirect_url (String)

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

  • is_for_embedded_signing (Boolean)

    Enable the UnclaimedDraft to be used for an Embedded SignatureRequest. Defaults to 0. (optional)

Returns:



270
271
272
273
274
# File 'lib/hello_sign/api/unclaimed_draft.rb', line 270

def edit_and_resend_unclaimed_draft(opts)
  signature_request_id = opts.delete(:signature_request_id)
  path = "/unclaimed_draft/edit_and_resend/#{signature_request_id}"
  HelloSign::Resource::UnclaimedDraft.new post(path, :body => opts)
end