From 90c803d884c1e6e7154d0f4bb05fa657308b28ce Mon Sep 17 00:00:00 2001 From: Jen Young Date: Thu, 3 Jan 2019 15:09:32 -0800 Subject: [PATCH 1/3] Add method to create embedded bulk send jobs --- lib/hello_sign/api/signature_request.rb | 80 ++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/lib/hello_sign/api/signature_request.rb b/lib/hello_sign/api/signature_request.rb index 99a3549..d309539 100644 --- a/lib/hello_sign/api/signature_request.rb +++ b/lib/hello_sign/api/signature_request.rb @@ -328,6 +328,80 @@ def bulk_send_with_template(opts) HelloSign::Resource::BulkSendJob.new post('/signature_request/bulk_send_with_template', body: opts) end + # Creates a BulkSendJob based off of the Template specified with the template_id parameter. + # @option opts [Boolean] test_mode Indicates if this is a test BulkSendJob, its SignatureRequests will not be legally binding if set to 1. Defaults to 0. (optional) + # @option opts [String] template_id The Template ID to use when creating the SignatureRequest. + # * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates + # @option opts [String] client_id The API App Client ID associated with this embedded BulkSendJob. + # @option opts [String] title Assigns a title to the SignatureRequest. (optional) + # @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional) + # @option opts [String] message Sets the message in the email sent to the signer(s). (optional) + # @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional) + # @option opts [String] signer_file Uploads a CSV file defining values and options for signer fields. Required if signer_list is not used. + # @option opts [String] signer_list A JSON array defining values and options for signer fields. Required if signer_file is not used. + # @option opts [Array] custom_fields An array of custom merge fields, representing those present on 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. + # * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional) + # * required (Boolean) Determines if the field is required or not. (optional) + # @option opts [Array] ccs 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 + # @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional) + # @option opts [String] client_id The API App Client ID associated with the SignatureRequest. (optional) + # + # @return [HelloSign::Resource::BulkSendJob] a BulkSendJob + # + # @example + # signature_request = @client.embedded_bulk_send_with_template( + # test_mode: 1, + # allow_decline: 0, + # template_id: 'c26b8a16784a872da37ea946b9ddec7c1e11dff6', + # client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a', + # title: 'Purchase Order', + # subject: 'Purchase Order', + # message: 'Glad we could come to an agreement.', + # metadata: { + # client_id: '1234', + # custom_text: 'NDA #9' + # }, + # signer_list: [ + # { + # signers: { + # Client: { + # name: 'George', + # email_address: 'bulksend1@example.com' + # } + # }, + # custom_fields: { + # address: '100 Grand' + # } + # }, + # { + # signers: { + # Client: { + # name: 'Mary', + # email_address: 'bulksend2@example.com' + # } + # } + # } + # ], + # ccs: [ + # { + # email_address: 'accounting@example.com', + # role: 'Accounting' + # } + # ] + # ) + def embedded_bulk_send_with_template(opts) + prepare_bulk_signers opts + prepare_ccs opts + prepare_templates opts + prepare_custom_fields opts + + HelloSign::Resource::BulkSendJob.new post('/signature_request/bulk_create_embedded_with_template', body: opts) + end + # Sends an email reminder to the signer about the SignatureRequest. # @option opts [String] signature_request_id Indicates the ID of the SignatureRequest to send a reminder. # @option opts [String] email_address The email address of the signer who will receive a reminder. @@ -380,7 +454,7 @@ def signature_request_files(opts) if opts[:file_type] path = path + "?file_type=#{opts[:file_type]}" end - + if opts[:get_url] separator = opts[:file_type].nil? ? '?' : '&' path = path + "#{separator}get_url=#{opts[:get_url]}" @@ -396,7 +470,7 @@ def signature_request_files(opts) # If form_fields_per_document is not specified or use_text_tags is not enabled, a signature page will be affixed at the end. # See our Embedded Signing Walkthrough for more information on Embedded Signing: https://app.hellosign.com/api/embeddedSigningWalkthrough. # @option opts [Boolean] test_mode Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. Defaults to 0. (optional) - # @option opts [String] client_id The API App Client ID associated with the this embedded SignatureRequest. + # @option opts [String] client_id The API App Client ID associated with this embedded SignatureRequest. # @option opts [Array] files 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. # @option opts [Array] file_urls 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. # @option opts [String] title Assigns a title to the SignatureRequest. (optional) @@ -489,7 +563,7 @@ def create_embedded_signature_request(opts) # Creates a new SignatureRequest based on the given Template to be signed in an embedded iFrame. # See our Embedded Signing Walkthrough for more information on Embedded Signing: https://app.hellosign.com/api/embeddedSigningWalkthrough. # @option opts [Boolean] test_mode Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. Defaults to 0. (optional) - # @option opts [String] client_id The API App Client ID associated with the this embedded SignatureRequest. + # @option opts [String] client_id The API App Client ID associated with this embedded SignatureRequest. # @option opts [String] template_id The Template ID to use when creating the SignatureRequest. # * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates # @option opts [String] title Assigns a title to the SignatureRequest. (optional) From 7466c005bca2fb01c451682604dc29e0996e6120 Mon Sep 17 00:00:00 2001 From: Jen Young Date: Thu, 3 Jan 2019 15:09:50 -0800 Subject: [PATCH 2/3] Version bump --- lib/hello_sign/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hello_sign/version.rb b/lib/hello_sign/version.rb index 95daefe..b5b1f8d 100644 --- a/lib/hello_sign/version.rb +++ b/lib/hello_sign/version.rb @@ -21,5 +21,5 @@ # SOFTWARE. module HelloSign - VERSION = '3.7.6' + VERSION = '3.7.7' end From a96a753ef473a71174b912ae02659c9f13697753 Mon Sep 17 00:00:00 2001 From: Jen Young Date: Thu, 3 Jan 2019 15:15:22 -0800 Subject: [PATCH 3/3] Add note that the new method is for embedded workflows --- lib/hello_sign/api/signature_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hello_sign/api/signature_request.rb b/lib/hello_sign/api/signature_request.rb index d309539..70b64d7 100644 --- a/lib/hello_sign/api/signature_request.rb +++ b/lib/hello_sign/api/signature_request.rb @@ -328,7 +328,7 @@ def bulk_send_with_template(opts) HelloSign::Resource::BulkSendJob.new post('/signature_request/bulk_send_with_template', body: opts) end - # Creates a BulkSendJob based off of the Template specified with the template_id parameter. + # Creates an embedded BulkSendJob based off of the Template specified with the template_id parameter. # @option opts [Boolean] test_mode Indicates if this is a test BulkSendJob, its SignatureRequests will not be legally binding if set to 1. Defaults to 0. (optional) # @option opts [String] template_id The Template ID to use when creating the SignatureRequest. # * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates