hellosign-api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +15 -0
- data/CONTRIBUTING.md +42 -0
- data/Gemfile +13 -0
- data/Guardfile +14 -0
- data/LICENSE +21 -0
- data/README.md +112 -0
- data/Rakefile +16 -0
- data/hellosign-api.gemspec +54 -0
- data/lib/hello_sign/.error.rb.swp +0 -0
- data/lib/hello_sign/api/account.rb +78 -0
- data/lib/hello_sign/api/api_app.rb +121 -0
- data/lib/hello_sign/api/bulk_send_job.rb +62 -0
- data/lib/hello_sign/api/embedded.rb +68 -0
- data/lib/hello_sign/api/oauth.rb +95 -0
- data/lib/hello_sign/api/signature_request.rb +691 -0
- data/lib/hello_sign/api/team.rb +107 -0
- data/lib/hello_sign/api/template.rb +227 -0
- data/lib/hello_sign/api/unclaimed_draft.rb +328 -0
- data/lib/hello_sign/api.rb +31 -0
- data/lib/hello_sign/client.rb +372 -0
- data/lib/hello_sign/configuration.rb +78 -0
- data/lib/hello_sign/error.rb +99 -0
- data/lib/hello_sign/resource/account.rb +43 -0
- data/lib/hello_sign/resource/api_app.rb +43 -0
- data/lib/hello_sign/resource/base_resource.rb +73 -0
- data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
- data/lib/hello_sign/resource/embedded.rb +43 -0
- data/lib/hello_sign/resource/resource_array.rb +56 -0
- data/lib/hello_sign/resource/signature_request.rb +43 -0
- data/lib/hello_sign/resource/team.rb +43 -0
- data/lib/hello_sign/resource/template.rb +43 -0
- data/lib/hello_sign/resource/template_draft.rb +44 -0
- data/lib/hello_sign/resource/unclaimed_draft.rb +44 -0
- data/lib/hello_sign/resource.rb +33 -0
- data/lib/hello_sign/version.rb +25 -0
- data/lib/hello_sign.rb +50 -0
- data/lib/hellosign-ruby-sdk.rb +4 -0
- data/spec/fixtures/account.json +15 -0
- data/spec/fixtures/api_app.json +16 -0
- data/spec/fixtures/api_apps.json +43 -0
- data/spec/fixtures/bulk_send_job.json +88 -0
- data/spec/fixtures/bulk_send_jobs.json +22 -0
- data/spec/fixtures/embedded.json +6 -0
- data/spec/fixtures/empty.pdf +0 -0
- data/spec/fixtures/error.json +6 -0
- data/spec/fixtures/file.json +0 -0
- data/spec/fixtures/headers.json +18 -0
- data/spec/fixtures/nda.pdf +0 -0
- data/spec/fixtures/signature_request.json +45 -0
- data/spec/fixtures/signature_requests.json +44 -0
- data/spec/fixtures/team.json +15 -0
- data/spec/fixtures/template.json +53 -0
- data/spec/fixtures/templates.json +59 -0
- data/spec/fixtures/token.json +14 -0
- data/spec/fixtures/unclaimed_draft.json +6 -0
- data/spec/hello_sign/.error_spec.rb.swp +0 -0
- data/spec/hello_sign/api/account_spec.rb +42 -0
- data/spec/hello_sign/api/api_app_spec.rb +104 -0
- data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
- data/spec/hello_sign/api/embedded_spec.rb +23 -0
- data/spec/hello_sign/api/oauth_spec.rb +27 -0
- data/spec/hello_sign/api/signature_request_spec.rb +268 -0
- data/spec/hello_sign/api/team_spec.rb +101 -0
- data/spec/hello_sign/api/template_spec.rb +172 -0
- data/spec/hello_sign/api/unclaimed_draft_spec.rb +145 -0
- data/spec/hello_sign/client_spec.rb +191 -0
- data/spec/hello_sign/error_spec.rb +10 -0
- data/spec/hello_sign/resource/base_resource_spec.rb +53 -0
- data/spec/hello_sign_spec.rb +57 -0
- data/spec/scenarios/uploads_spec.rb +19 -0
- data/spec/spec_helper.rb +104 -0
- metadata +261 -0
@@ -0,0 +1,691 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Api
|
25
|
+
# Contains all the API calls for the SignatureRequest resource.
|
26
|
+
# Take a look at our API Documentation on Signature Requests (https://app.hellosign.com/api/reference#SignatureRequest)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
module SignatureRequest
|
32
|
+
|
33
|
+
# Retrieves a SignatureRequest with the given ID.
|
34
|
+
# @option opts [String] signature_request_id The ID of the SignatureRequest to retrieve.
|
35
|
+
#
|
36
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# signature_request = @client.get_signature_request signature_request_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
|
40
|
+
def get_signature_request(opts)
|
41
|
+
path = "/signature_request/#{opts[:signature_request_id]}"
|
42
|
+
|
43
|
+
HelloSign::Resource::SignatureRequest.new get(path)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns a list of send and received SignatureRequests that you can access. This does not include ones that you have been CC'd on.
|
47
|
+
# @option opts [String] account_id Indicates which account to return SignatureRequests for. Defaults to your account. (optional)
|
48
|
+
# @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
|
49
|
+
# @option opts [Integer] page_size Determines the number of SignatureRequests returned per page. Defaults to 20. (optional)
|
50
|
+
# @option opts [String] query Filters the SignatureRequests based on the search parameters. (optional)
|
51
|
+
#
|
52
|
+
# @return [HelloSign::Resource::ResourceArray]
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# signature_requests = @client.get_signature_requests(
|
56
|
+
# page: 1,
|
57
|
+
# query: "to:jack@example.com+AND+client_id:b6b8e7deaf8f0b95c029dca049356d4a2cf9710a"
|
58
|
+
# )
|
59
|
+
def get_signature_requests(opts={})
|
60
|
+
path = '/signature_request/list'
|
61
|
+
opts[:query] = create_search_string(opts[:query]) if opts[:query]
|
62
|
+
query = create_query_string(opts, [:page, :page_size, :query])
|
63
|
+
path += query
|
64
|
+
HelloSign::Resource::ResourceArray.new get(path, opts), 'signature_requests', HelloSign::Resource::SignatureRequest
|
65
|
+
end
|
66
|
+
|
67
|
+
# Creates and sends a new SignatureRequest with the submitted documents.
|
68
|
+
# @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)
|
69
|
+
# @option opts [Array<String>] files Specifies the file path(s) to send for the SignatureRequest.
|
70
|
+
# @option opts [Array<String>] file_urls Specifies the URL(s) for the file(s) to send for the SignatureRequest.
|
71
|
+
# @option opts [String] title Assigns a title to the SignatureRequest. (optional)
|
72
|
+
# @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
|
73
|
+
# @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
|
74
|
+
# @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
|
75
|
+
# @option opts [Array<Hash>] signers Sets a list of signers, each item is a Hash with these keys:
|
76
|
+
# * name (String) Signer's name
|
77
|
+
# * email_address (String) Signer's email address
|
78
|
+
# * order (Integer) The order the signers are required to sign in (optional)
|
79
|
+
# * pin (Integer) Secures the SignatureRequest using this 4-12 character access code. A business plan is required to use this feature. (optional)
|
80
|
+
# @option opts [Array<Hash>] attachments Sets a list of attachments signers can upload
|
81
|
+
# * name (String) Attachment name
|
82
|
+
# * instructions (String) Instructions for uploading the attachment. (optional)
|
83
|
+
# * signer_index (Integer) The signer's unique number.
|
84
|
+
# * required (Boolean) Determines if the signer is required to upload this attachment. Defaults to 0. (Optional)
|
85
|
+
# @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present on the document with Text Tags or form_fields_per_document (optional)
|
86
|
+
# * name (String) Custom field name or "Field Label"
|
87
|
+
# * value (String) The value of the field. This data will appear on the SignatureRequest.
|
88
|
+
# * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional)
|
89
|
+
# * required (Boolean) Determines if the field is required or not. (optional)
|
90
|
+
# @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed on the SignatureRequest. (optional)
|
91
|
+
# @option opts [Boolean] use_text_tags Indicates whether the SignatureRequest should have Text Tags enabled. Defaults to 0. (optional)
|
92
|
+
# @option opts [Boolean] hide_text_tags Indicates whether the Text Tags should be removed automatically. Note that this is not the preferred method. Defaults to 0. (optional)
|
93
|
+
# @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
|
94
|
+
# @option opts [String] client_id The API App Client ID associated with the SignatureRequest. (optional)
|
95
|
+
# @option opts [Boolean] allow_decline Allows signers to decline the SignatureRequest. Defaults to 0. (optional)
|
96
|
+
# @option opts [Boolean] allow_reassign Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)
|
97
|
+
# @option opts [Array<Hash>] form_fields_per_document The fields that should appear on the document. (optional)
|
98
|
+
# @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
|
99
|
+
#
|
100
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
101
|
+
#
|
102
|
+
# @example
|
103
|
+
# signature_request = @client.send_signature_request(
|
104
|
+
# test_mode: 1,
|
105
|
+
# allow_decline: 1,
|
106
|
+
# client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
|
107
|
+
# title: 'NDA with Acme Co.',
|
108
|
+
# subject: 'The NDA we talked about',
|
109
|
+
# message: 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
|
110
|
+
# metadata: {
|
111
|
+
# client_name: 'John Doe',
|
112
|
+
# custom_text: 'NDA #9'
|
113
|
+
# },
|
114
|
+
# signers: [{
|
115
|
+
# email_address: 'jack@example.com',
|
116
|
+
# name: 'Jack',
|
117
|
+
# order: 0,
|
118
|
+
# },
|
119
|
+
# {
|
120
|
+
# email_address: 'jill@example.com',
|
121
|
+
# name: 'Jill',
|
122
|
+
# order: 1,
|
123
|
+
# }],
|
124
|
+
# attachments: [{
|
125
|
+
# name: 'Passport',
|
126
|
+
# instructions: 'Upload your US Passport',
|
127
|
+
# signer_index: 0,
|
128
|
+
# required: true
|
129
|
+
# },
|
130
|
+
# {
|
131
|
+
# name: 'Driver's License',
|
132
|
+
# instructions: 'Upload your CA Driver's License',
|
133
|
+
# signer_index: 1,
|
134
|
+
# required: false
|
135
|
+
# }
|
136
|
+
# ],
|
137
|
+
# cc_email_addresses: ['lawyer@example.com', 'lawyer@example2.com'],
|
138
|
+
# files: ['NDA.pdf', 'AppendixA.pdf'],
|
139
|
+
# form_fields_per_document: [
|
140
|
+
# [
|
141
|
+
# {
|
142
|
+
# name: 'address',
|
143
|
+
# type: 'text',
|
144
|
+
# x: 160,
|
145
|
+
# y: 80,
|
146
|
+
# width: 206,
|
147
|
+
# height: 32,
|
148
|
+
# signer: 0
|
149
|
+
# }
|
150
|
+
# ],
|
151
|
+
# [
|
152
|
+
# {
|
153
|
+
# name: 'phone',
|
154
|
+
# type: 'text',
|
155
|
+
# x: 160,
|
156
|
+
# y: 150,
|
157
|
+
# width: 206,
|
158
|
+
# height: 32,
|
159
|
+
# signer: 1
|
160
|
+
# }
|
161
|
+
# ]
|
162
|
+
# ],
|
163
|
+
# signing_options: {
|
164
|
+
# draw: true,
|
165
|
+
# type: true,
|
166
|
+
# upload: false,
|
167
|
+
# phone: true,
|
168
|
+
# default: 'phone'
|
169
|
+
# }
|
170
|
+
# )
|
171
|
+
def send_signature_request(opts)
|
172
|
+
opts[:client_id] ||= self.client_id
|
173
|
+
prepare_files opts
|
174
|
+
prepare_signers opts
|
175
|
+
prepare_form_fields opts
|
176
|
+
prepare_custom_fields opts
|
177
|
+
prepare_attachments opts
|
178
|
+
|
179
|
+
request = HelloSign::Resource::SignatureRequest.new post('/signature_request/send', body: opts)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Creates and sends a new SignatureRequest based off of the Template specified with the template_id parameter.
|
183
|
+
# @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)
|
184
|
+
# @option opts [Boolean] allow_decline Allows signers to decline the SignatureRequest. Defaults to 0. (optional)
|
185
|
+
# @option opts [String] template_id The Template ID to use when creating the SignatureRequest.
|
186
|
+
# * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates
|
187
|
+
# @option opts [String] title Assigns a title to the SignatureRequest. (optional)
|
188
|
+
# @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
|
189
|
+
# @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
|
190
|
+
# @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
|
191
|
+
# @option opts [Array<Hash>] signer_file Sets a list of signers, each item is a Hash with these keys:
|
192
|
+
# * role (Integer) The signer role indicated on the Template.
|
193
|
+
# * name (String) Signer's name
|
194
|
+
# * email_address (String) Signer's email address
|
195
|
+
# * pin (Integer) Secures the SignatureRequest using this 4-12 character access code. A business plan is required to use this feature. (optional)
|
196
|
+
# @option opts [Array<Hash>] ccs The individual(s) to be CC'd on the SignatureRequest. Required when a CC role exists for the Template.
|
197
|
+
# * role (String) The CC role indicated on the Template. Note that the role name is case sensitive.
|
198
|
+
# * email_address (String) CC Recipient's email address
|
199
|
+
# @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present on the Template. (optional)
|
200
|
+
# * name (String) Custom field name or "Field Label"
|
201
|
+
# * value (String) The value of the field. This data will appear on the SignatureRequest.
|
202
|
+
# * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional)
|
203
|
+
# * required (Boolean) Determines if the field is required or not. (optional)
|
204
|
+
# @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
|
205
|
+
# @option opts [String] client_id The API App Client ID associated with the SignatureRequest. (optional)
|
206
|
+
# @option opts [Array<String>] files Use files to indicate the uploaded file(s) to append to the SignatureRequest. (optional)
|
207
|
+
# @option opts [Array<String>] file_urls Use file_urls to have HelloSign download the file(s) to append to the SignatureRequest. (optional)
|
208
|
+
# @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
|
209
|
+
#
|
210
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
211
|
+
#
|
212
|
+
# @example
|
213
|
+
# signature_request = @client.send_signature_request_with_template(
|
214
|
+
# test_mode: 1,
|
215
|
+
# allow_decline: 0,
|
216
|
+
# client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
|
217
|
+
# template_id: 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
|
218
|
+
# title: 'Purchase Order',
|
219
|
+
# subject: 'Purchase Order',
|
220
|
+
# message: 'Glad we could come to an agreement.',
|
221
|
+
# files: ['NDA.pdf', 'AppendixA.pdf'],
|
222
|
+
# metadata: {
|
223
|
+
# client_name: 'John Doe',
|
224
|
+
# custom_text: 'NDA #9'
|
225
|
+
# },
|
226
|
+
# signers: [
|
227
|
+
# {
|
228
|
+
# email_address: 'george@example.com',
|
229
|
+
# name: 'George',
|
230
|
+
# role: 'Client'
|
231
|
+
# }
|
232
|
+
# ],
|
233
|
+
# ccs: [
|
234
|
+
# {
|
235
|
+
# email_address: 'accounting@example.com',
|
236
|
+
# role: 'Accounting'
|
237
|
+
# }
|
238
|
+
# ],
|
239
|
+
# custom_fields: [
|
240
|
+
# {
|
241
|
+
# CustomFieldName: '$20,000'
|
242
|
+
# }
|
243
|
+
# ],
|
244
|
+
# signing_options: {
|
245
|
+
# draw: true,
|
246
|
+
# type: true,
|
247
|
+
# upload: false,
|
248
|
+
# phone: true,
|
249
|
+
# default: 'phone'
|
250
|
+
# }
|
251
|
+
# )
|
252
|
+
def send_signature_request_with_template(opts)
|
253
|
+
opts[:client_id] ||= self.client_id
|
254
|
+
prepare_signers opts
|
255
|
+
prepare_ccs opts
|
256
|
+
prepare_templates opts
|
257
|
+
prepare_custom_fields opts
|
258
|
+
prepare_files opts
|
259
|
+
|
260
|
+
HelloSign::Resource::SignatureRequest.new post('/signature_request/send_with_template', body: opts)
|
261
|
+
end
|
262
|
+
|
263
|
+
# Creates a BulkSendJob based off of the Template specified with the template_id parameter.
|
264
|
+
# @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)
|
265
|
+
# @option opts [String] template_id The Template ID to use when creating the SignatureRequest.
|
266
|
+
# * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates
|
267
|
+
# @option opts [String] title Assigns a title to the SignatureRequest. (optional)
|
268
|
+
# @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
|
269
|
+
# @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
|
270
|
+
# @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
|
271
|
+
# @option opts [String] signer_file Uploads a CSV file defining values and options for signer fields. Required if signer_list is not used.
|
272
|
+
# @option opts [String] signer_list A JSON array defining values and options for signer fields. Required if signer_file is not used.
|
273
|
+
# @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present on the Template. (optional)
|
274
|
+
# * name (String) Custom field name or "Field Label"
|
275
|
+
# * value (String) The value of the field. This data will appear on the SignatureRequest.
|
276
|
+
# * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional)
|
277
|
+
# * required (Boolean) Determines if the field is required or not. (optional)
|
278
|
+
# @option opts [Array<Hash>] ccs The individual(s) to be CC'd on the SignatureRequest. Required when a CC role exists for the Template.
|
279
|
+
# * role (String) The CC role indicated on the Template. Note that the role name is case sensitive.
|
280
|
+
# * email_address (String) CC Recipient's email address
|
281
|
+
# @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
|
282
|
+
# @option opts [String] client_id The API App Client ID associated with the SignatureRequest. (optional)
|
283
|
+
#
|
284
|
+
# @return [HelloSign::Resource::BulkSendJob] a BulkSendJob
|
285
|
+
#
|
286
|
+
# @example
|
287
|
+
# signature_request = @client.bulk_send_with_template(
|
288
|
+
# test_mode: 1,
|
289
|
+
# allow_decline: 0,
|
290
|
+
# client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
|
291
|
+
# template_id: 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
|
292
|
+
# title: 'Purchase Order',
|
293
|
+
# subject: 'Purchase Order',
|
294
|
+
# message: 'Glad we could come to an agreement.',
|
295
|
+
# metadata: {
|
296
|
+
# client_name: 'John Doe',
|
297
|
+
# custom_text: 'NDA #9'
|
298
|
+
# },
|
299
|
+
# signer_list: [
|
300
|
+
# {
|
301
|
+
# signers: {
|
302
|
+
# Client: {
|
303
|
+
# name: 'George',
|
304
|
+
# email_address: 'bulksend1@example.com'
|
305
|
+
# }
|
306
|
+
# },
|
307
|
+
# custom_fields: {
|
308
|
+
# address: '100 Grand'
|
309
|
+
# }
|
310
|
+
# },
|
311
|
+
# {
|
312
|
+
# signers: {
|
313
|
+
# Client: {
|
314
|
+
# name: 'Mary',
|
315
|
+
# email_address: 'bulksend2@example.com'
|
316
|
+
# }
|
317
|
+
# }
|
318
|
+
# }
|
319
|
+
# ],
|
320
|
+
# ccs: [
|
321
|
+
# {
|
322
|
+
# email_address: 'accounting@example.com',
|
323
|
+
# role: 'Accounting'
|
324
|
+
# }
|
325
|
+
# ]
|
326
|
+
# )
|
327
|
+
def bulk_send_with_template(opts)
|
328
|
+
opts[:client_id] ||= self.client_id
|
329
|
+
prepare_bulk_signers opts
|
330
|
+
prepare_ccs opts
|
331
|
+
prepare_templates opts
|
332
|
+
prepare_custom_fields opts
|
333
|
+
|
334
|
+
HelloSign::Resource::BulkSendJob.new post('/signature_request/bulk_send_with_template', body: opts)
|
335
|
+
end
|
336
|
+
|
337
|
+
# Creates an embedded BulkSendJob based off of the Template specified with the template_id parameter.
|
338
|
+
# @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)
|
339
|
+
# @option opts [String] template_id The Template ID to use when creating the SignatureRequest.
|
340
|
+
# * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates
|
341
|
+
# @option opts [String] client_id The API App Client ID associated with this embedded BulkSendJob.
|
342
|
+
# @option opts [String] title Assigns a title to the SignatureRequest. (optional)
|
343
|
+
# @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
|
344
|
+
# @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
|
345
|
+
# @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
|
346
|
+
# @option opts [String] signer_file Uploads a CSV file defining values and options for signer fields. Required if signer_list is not used.
|
347
|
+
# @option opts [String] signer_list A JSON array defining values and options for signer fields. Required if signer_file is not used.
|
348
|
+
# @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present on the Template. (optional)
|
349
|
+
# * name (String) Custom field name or "Field Label"
|
350
|
+
# * value (String) The value of the field. This data will appear on the SignatureRequest.
|
351
|
+
# * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional)
|
352
|
+
# * required (Boolean) Determines if the field is required or not. (optional)
|
353
|
+
# @option opts [Array<Hash>] ccs The individual(s) to be CC'd on the SignatureRequest. Required when a CC role exists for the Template.
|
354
|
+
# * role (String) The CC role indicated on the Template. Note that the role name is case sensitive.
|
355
|
+
# * email_address (String) CC Recipient's email address
|
356
|
+
# @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
|
357
|
+
# @option opts [String] client_id The API App Client ID associated with the SignatureRequest. (optional)
|
358
|
+
#
|
359
|
+
# @return [HelloSign::Resource::BulkSendJob] a BulkSendJob
|
360
|
+
#
|
361
|
+
# @example
|
362
|
+
# signature_request = @client.embedded_bulk_send_with_template(
|
363
|
+
# test_mode: 1,
|
364
|
+
# allow_decline: 0,
|
365
|
+
# template_id: 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
|
366
|
+
# client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
|
367
|
+
# title: 'Purchase Order',
|
368
|
+
# subject: 'Purchase Order',
|
369
|
+
# message: 'Glad we could come to an agreement.',
|
370
|
+
# metadata: {
|
371
|
+
# client_name: 'John Doe',
|
372
|
+
# custom_text: 'NDA #9'
|
373
|
+
# },
|
374
|
+
# signer_list: [
|
375
|
+
# {
|
376
|
+
# signers: {
|
377
|
+
# Client: {
|
378
|
+
# name: 'George',
|
379
|
+
# email_address: 'bulksend1@example.com'
|
380
|
+
# }
|
381
|
+
# },
|
382
|
+
# custom_fields: {
|
383
|
+
# address: '100 Grand'
|
384
|
+
# }
|
385
|
+
# },
|
386
|
+
# {
|
387
|
+
# signers: {
|
388
|
+
# Client: {
|
389
|
+
# name: 'Mary',
|
390
|
+
# email_address: 'bulksend2@example.com'
|
391
|
+
# }
|
392
|
+
# }
|
393
|
+
# }
|
394
|
+
# ],
|
395
|
+
# ccs: [
|
396
|
+
# {
|
397
|
+
# email_address: 'accounting@example.com',
|
398
|
+
# role: 'Accounting'
|
399
|
+
# }
|
400
|
+
# ]
|
401
|
+
# )
|
402
|
+
def embedded_bulk_send_with_template(opts)
|
403
|
+
opts[:client_id] ||= self.client_id
|
404
|
+
prepare_bulk_signers opts
|
405
|
+
prepare_ccs opts
|
406
|
+
prepare_templates opts
|
407
|
+
prepare_custom_fields opts
|
408
|
+
|
409
|
+
HelloSign::Resource::BulkSendJob.new post('/signature_request/bulk_create_embedded_with_template', body: opts)
|
410
|
+
end
|
411
|
+
|
412
|
+
# Sends an email reminder to the signer about the SignatureRequest.
|
413
|
+
# @option opts [String] signature_request_id Indicates the ID of the SignatureRequest to send a reminder.
|
414
|
+
# @option opts [String] email_address The email address of the signer who will receive a reminder.
|
415
|
+
# @option opts [String] name The name of the signer who will receive a reminder. (optional)
|
416
|
+
#
|
417
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
418
|
+
#
|
419
|
+
# @example
|
420
|
+
# signature_request = @client.remind_signature_request(
|
421
|
+
# signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491',
|
422
|
+
# :email_address: 'john@example.com'
|
423
|
+
# )
|
424
|
+
def remind_signature_request(opts)
|
425
|
+
HelloSign::Resource::SignatureRequest.new post("/signature_request/remind/#{opts[:signature_request_id]}", body: opts)
|
426
|
+
end
|
427
|
+
|
428
|
+
# Cancels an incomplete SignatureRequest.
|
429
|
+
# @option opts [String] signature_request_id The ID of SignatureRequest to cancel.
|
430
|
+
#
|
431
|
+
# @return [HTTP::Status] 200 OK
|
432
|
+
#
|
433
|
+
# @example
|
434
|
+
# @client.cancel_signature_request signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491'
|
435
|
+
def cancel_signature_request(opts)
|
436
|
+
post("/signature_request/cancel/#{opts[:signature_request_id]}", body: opts)
|
437
|
+
end
|
438
|
+
|
439
|
+
# Removes your access to a completed a SignatureRequest.
|
440
|
+
# @option opts [String] signature_request_id The ID of the completed SignatureRequest to remove access.
|
441
|
+
#
|
442
|
+
# @return [HTTP::Status] 200 OK
|
443
|
+
#
|
444
|
+
# @example
|
445
|
+
# @client.remove_signature_request signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491'
|
446
|
+
def remove_signature_request(opts)
|
447
|
+
post("/signature_request/remove/#{opts[:signature_request_id]}", body: opts)
|
448
|
+
end
|
449
|
+
|
450
|
+
# Downloads a copy of the SignatureRequest documents.
|
451
|
+
# @option opts [String] signature_request_id The ID of the SignatureRequest to download.
|
452
|
+
# @option opts [String] file_type Determines the format of the file - either 'pdf' or 'zip' depending on the file type desired. Defaults to pdf. (optional)
|
453
|
+
# @option opts [Boolean] get_url Response contains a URL link to the file if set to true. Links are only available for PDFs and have a TTL of 3 days. Defaults to false. (optional)
|
454
|
+
#
|
455
|
+
# @return a PDF or Zip
|
456
|
+
#
|
457
|
+
# @example
|
458
|
+
# pdf = @client.signature_request_files signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491'
|
459
|
+
def signature_request_files(opts)
|
460
|
+
path = "/signature_request/files/#{opts[:signature_request_id]}"
|
461
|
+
if opts[:file_type]
|
462
|
+
path = path + "?file_type=#{opts[:file_type]}"
|
463
|
+
end
|
464
|
+
|
465
|
+
if opts[:get_url]
|
466
|
+
separator = opts[:file_type].nil? ? '?' : '&'
|
467
|
+
path = path + "#{separator}get_url=#{opts[:get_url]}"
|
468
|
+
elsif opts[:get_data_uri]
|
469
|
+
separator = opts[:file_type].nil? ? '?' : '&'
|
470
|
+
path = path + "#{separator}get_data_uri=#{opts[:get_data_uri]}"
|
471
|
+
end
|
472
|
+
|
473
|
+
get(path)[:body]
|
474
|
+
end
|
475
|
+
|
476
|
+
# Creates a new SignatureRequest with the submitted documents to be signed in an embedded iFrame.
|
477
|
+
# If form_fields_per_document is not specified or use_text_tags is not enabled, a signature page will be affixed at the end.
|
478
|
+
# See our Embedded Signing Walkthrough for more information on Embedded Signing: https://app.hellosign.com/api/embeddedSigningWalkthrough.
|
479
|
+
# @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)
|
480
|
+
# @option opts [String] client_id The API App Client ID associated with this embedded SignatureRequest.
|
481
|
+
# @option opts [Array<String>] 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.
|
482
|
+
# @option opts [Array<String>] 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.
|
483
|
+
# @option opts [String] title Assigns a title to the SignatureRequest. (optional)
|
484
|
+
# @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
|
485
|
+
# @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
|
486
|
+
# @option opts [Array<Hash>] signers Sets a list of signers, each item is a Hash with these keys:
|
487
|
+
# * name (String) Signer's name
|
488
|
+
# * email_address (String) Signer's email address
|
489
|
+
# * order (Integer) The order the signers are required to sign in (optional)
|
490
|
+
# * pin (Integer) Secures the SignatureRequest using this 4-12 character access code. A business plan is required to use this feature. (optional)
|
491
|
+
# @option opts [Array<Hash>] attachments Sets a list of attachments signers can upload
|
492
|
+
# * name (String) Attachment name
|
493
|
+
# * instructions (String) Instructions for uploading the attachment. (optional)
|
494
|
+
# * signer_index (Integer) The signer's unique number.
|
495
|
+
# * required (Boolean) Determines if the signer is required to upload this attachment. Defaults to 0. (Optional)
|
496
|
+
# @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present on the document with Text Tags or form_fields_per_document (optional)
|
497
|
+
# * name (String) Custom field name or "Field Label"
|
498
|
+
# * value (String) The value of the field. This data will appear on the SignatureRequest.
|
499
|
+
# * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional)
|
500
|
+
# * required (Boolean) Determines if the field is required or not. (optional)
|
501
|
+
# @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed on the SignatureRequest. (optional)
|
502
|
+
# @option opts [Boolean] use_text_tags Indicates whether the SignatureRequest should have Text Tags enabled. Defaults to 0. (optional)
|
503
|
+
# @option opts [Boolean] hide_text_tags Indicates whether the Text Tags should be removed automatically. Note that this is not the preferred method. Defaults to 0. (optional)
|
504
|
+
# @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
|
505
|
+
# @option opts [Boolean] allow_decline Allows signers to decline the SignatureRequest. Defaults to 0. (optional)
|
506
|
+
# @option opts [Boolean] allow_reassign Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)
|
507
|
+
# @option opts [Array<Hash>] form_fields_per_document The fields that should appear on the document. (optional)
|
508
|
+
# @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
|
509
|
+
#
|
510
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
511
|
+
#
|
512
|
+
# @example
|
513
|
+
# request = @client.create_embedded_signature_request(
|
514
|
+
# test_mode: 1,
|
515
|
+
# allow_decline: 1,
|
516
|
+
# client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
|
517
|
+
# title: 'NDA with Acme Co.',
|
518
|
+
# subject: 'The NDA we talked about',
|
519
|
+
# message: 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
|
520
|
+
# metadata: {
|
521
|
+
# client_name: 'John Doe',
|
522
|
+
# custom_text: 'NDA #9'
|
523
|
+
# },
|
524
|
+
# signers: [
|
525
|
+
# {
|
526
|
+
# email_address: 'jack@example.com',
|
527
|
+
# name: 'Jack',
|
528
|
+
# order: 0,
|
529
|
+
# },
|
530
|
+
# {
|
531
|
+
# email_address: 'jill@example.com',
|
532
|
+
# name: 'Jill',
|
533
|
+
# order: 1,
|
534
|
+
# }
|
535
|
+
# ],
|
536
|
+
# attachments: [{
|
537
|
+
# name: 'Passport',
|
538
|
+
# instructions: 'Upload your US Passport',
|
539
|
+
# signer_index: 0,
|
540
|
+
# required: true
|
541
|
+
# },
|
542
|
+
# {
|
543
|
+
# name: 'Driver's License',
|
544
|
+
# instructions: 'Upload your CA Driver's License',
|
545
|
+
# signer_index: 1,
|
546
|
+
# required: false
|
547
|
+
# }
|
548
|
+
# ],
|
549
|
+
# cc_email_addresses: ['lawyer@example.com', 'lawyer@example2.com'],
|
550
|
+
# files: ['NDA.pdf', 'AppendixA.pdf'],
|
551
|
+
# signing_options: {
|
552
|
+
# draw: true,
|
553
|
+
# type: true,
|
554
|
+
# upload: false,
|
555
|
+
# phone: true,
|
556
|
+
# default: 'phone'
|
557
|
+
# }
|
558
|
+
# )
|
559
|
+
def create_embedded_signature_request(opts)
|
560
|
+
opts[:client_id] ||= self.client_id
|
561
|
+
prepare_files opts
|
562
|
+
prepare_signers opts
|
563
|
+
prepare_form_fields opts
|
564
|
+
prepare_custom_fields opts
|
565
|
+
prepare_attachments opts
|
566
|
+
|
567
|
+
HelloSign::Resource::SignatureRequest.new post('/signature_request/create_embedded', body: opts)
|
568
|
+
end
|
569
|
+
|
570
|
+
# Creates a new SignatureRequest based on the given Template to be signed in an embedded iFrame.
|
571
|
+
# See our Embedded Signing Walkthrough for more information on Embedded Signing: https://app.hellosign.com/api/embeddedSigningWalkthrough.
|
572
|
+
# @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)
|
573
|
+
# @option opts [String] client_id The API App Client ID associated with this embedded SignatureRequest.
|
574
|
+
# @option opts [String] template_id The Template ID to use when creating the SignatureRequest.
|
575
|
+
# * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates
|
576
|
+
# @option opts [String] title Assigns a title to the SignatureRequest. (optional)
|
577
|
+
# @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
|
578
|
+
# @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
|
579
|
+
# @option opts [Array<Hash>] signers Sets a list of signers, each item is a Hash with these keys:
|
580
|
+
# * name (String) Signer's name
|
581
|
+
# * email_address (String) Signer's email address
|
582
|
+
# * order (Integer) The order the signers are required to sign in (optional)
|
583
|
+
# * pin (Integer) Secures the SignatureRequest using this 4-12 character access code. A business plan is required to use this feature. (optional)
|
584
|
+
# @option opts [Array<Hash>] ccs The individual(s) to be CC'd on the SignatureRequest. Required when a CC role exists for the Template.
|
585
|
+
# * role (String) The CC role indicated on the Template. Note that the role name is case sensitive.
|
586
|
+
# * email_address (String) CC Recipient's email address
|
587
|
+
# @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present in the Template. (optional)
|
588
|
+
# * name (String) Custom field name or "Field Label"
|
589
|
+
# * value (String) The value of the field. This data will appear on the SignatureRequest.
|
590
|
+
# * editor (String) The signer name indicated on the Text Tag or form_fields_per_document that can edit the value of the field. (optional)
|
591
|
+
# * required (Boolean) Determines if the field is required or not. (optional)
|
592
|
+
# @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
|
593
|
+
# @option opts [Array<String>] files Use files to indicate the uploaded file(s) to append to the SignatureRequest. (optional)
|
594
|
+
# @option opts [Array<String>] file_urls Use file_urls to have HelloSign download the file(s) to append to the SignatureRequest. (optional)
|
595
|
+
# @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
|
596
|
+
#
|
597
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
598
|
+
#
|
599
|
+
# @example
|
600
|
+
# request = @client.create_embedded_signature_request_with_template(
|
601
|
+
# test_mode: 1,
|
602
|
+
# allow_decline: 1,
|
603
|
+
# client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
|
604
|
+
# template_id: 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
|
605
|
+
# title: 'Purchase Order',
|
606
|
+
# subject: 'Purchase Order',
|
607
|
+
# message: 'Glad we could come to an agreement.',
|
608
|
+
# files: ['NDA.pdf', 'AppendixA.pdf'],
|
609
|
+
# metadata: {
|
610
|
+
# client_name: 'John Doe',
|
611
|
+
# custom_text: 'NDA #9'
|
612
|
+
# },
|
613
|
+
# signers: [
|
614
|
+
# {
|
615
|
+
# email_address: 'george@example.com',
|
616
|
+
# name: 'George',
|
617
|
+
# role: 'Client'
|
618
|
+
# }
|
619
|
+
# ],
|
620
|
+
# ccs: [
|
621
|
+
# {
|
622
|
+
# email_address: 'accounting@example.com',
|
623
|
+
# role: 'Accounting'
|
624
|
+
# }
|
625
|
+
# ],
|
626
|
+
# custom_fields: {
|
627
|
+
# Cost: '$20,000'
|
628
|
+
# },
|
629
|
+
# signing_options: {
|
630
|
+
# draw: true,
|
631
|
+
# type: true,
|
632
|
+
# upload: false,
|
633
|
+
# phone: true,
|
634
|
+
# default: 'phone'
|
635
|
+
# }
|
636
|
+
# )
|
637
|
+
#
|
638
|
+
def create_embedded_signature_request_with_template(opts)
|
639
|
+
opts[:client_id] ||= self.client_id
|
640
|
+
prepare_signers opts
|
641
|
+
prepare_ccs opts
|
642
|
+
prepare_templates opts
|
643
|
+
prepare_custom_fields opts
|
644
|
+
prepare_files opts
|
645
|
+
|
646
|
+
HelloSign::Resource::SignatureRequest.new post('/signature_request/create_embedded_with_template', body: opts)
|
647
|
+
end
|
648
|
+
|
649
|
+
# Releases a held SignatureRequest that was claimed and prepared from an UnclaimedDraft.
|
650
|
+
# @option opts [String] signature_request_id The ID of the SignatureRequest to release.
|
651
|
+
#
|
652
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
653
|
+
#
|
654
|
+
# @example
|
655
|
+
# @client.release_on_hold_signature_request signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491'
|
656
|
+
def release_on_hold_signature_request(opts)
|
657
|
+
HelloSign::Resource::SignatureRequest.new post("/signature_request/release_hold/#{opts[:signature_request_id]}", body: opts)
|
658
|
+
end
|
659
|
+
|
660
|
+
# Updates the email address on a SignatureRequest.
|
661
|
+
# @option opts [String] signature_request_id The ID of the SignatureRequest to update.
|
662
|
+
# @option opts [String] signature_id The Signature ID of the recipient to update.
|
663
|
+
# @option opts [String] email_address The new email address of the recipient.
|
664
|
+
#
|
665
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
666
|
+
#
|
667
|
+
# @example
|
668
|
+
# @client.update_signature_request(
|
669
|
+
# signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491',
|
670
|
+
# signature_id: '5064ca698bde9581ad75f6d62450eb4b',
|
671
|
+
# email_address: 'newEmail@example.com'
|
672
|
+
# )
|
673
|
+
def update_signature_request(opts)
|
674
|
+
signature_request_id = opts.delete(:signature_request_id)
|
675
|
+
path = "/signature_request/update/#{signature_request_id}"
|
676
|
+
HelloSign::Resource::SignatureRequest.new post(path, body: opts)
|
677
|
+
end
|
678
|
+
|
679
|
+
# Releases a held SignatureRequest that was claimed and prepared from an UnclaimedDraft.
|
680
|
+
# @option opts [String] signature_request_id The ID of the SignatureRequest to release.
|
681
|
+
#
|
682
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
683
|
+
#
|
684
|
+
# @example
|
685
|
+
# @client.release_signature_request signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491'
|
686
|
+
def release_hold_signature_request(opts)
|
687
|
+
HelloSign::Resource::SignatureRequest.new post("/signature_request/release_hold/#{opts[:signature_request_id]}", body: opts)
|
688
|
+
end
|
689
|
+
end
|
690
|
+
end
|
691
|
+
end
|