hellosign-ruby-sdk 3.7.5 → 3.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -2
  3. data/lib/hello_sign.rb +7 -12
  4. data/lib/hello_sign/api.rb +1 -2
  5. data/lib/hello_sign/api/account.rb +17 -30
  6. data/lib/hello_sign/api/api_app.rb +27 -25
  7. data/lib/hello_sign/api/bulk_send_job.rb +62 -0
  8. data/lib/hello_sign/api/embedded.rb +17 -23
  9. data/lib/hello_sign/api/oauth.rb +26 -34
  10. data/lib/hello_sign/api/signature_request.rb +370 -261
  11. data/lib/hello_sign/api/team.rb +21 -26
  12. data/lib/hello_sign/api/template.rb +79 -70
  13. data/lib/hello_sign/api/unclaimed_draft.rb +193 -142
  14. data/lib/hello_sign/client.rb +58 -22
  15. data/lib/hello_sign/configuration.rb +3 -7
  16. data/lib/hello_sign/error.rb +2 -3
  17. data/lib/hello_sign/resource.rb +1 -2
  18. data/lib/hello_sign/resource/account.rb +3 -6
  19. data/lib/hello_sign/resource/api_app.rb +3 -6
  20. data/lib/hello_sign/resource/base_resource.rb +5 -9
  21. data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
  22. data/lib/hello_sign/resource/embedded.rb +7 -10
  23. data/lib/hello_sign/resource/resource_array.rb +7 -10
  24. data/lib/hello_sign/resource/signature_request.rb +6 -9
  25. data/lib/hello_sign/resource/team.rb +3 -6
  26. data/lib/hello_sign/resource/template.rb +5 -8
  27. data/lib/hello_sign/resource/template_draft.rb +4 -7
  28. data/lib/hello_sign/resource/unclaimed_draft.rb +5 -10
  29. data/lib/hello_sign/version.rb +1 -3
  30. data/spec/fixtures/api_app.json +10 -10
  31. data/spec/fixtures/bulk_send_job.json +88 -0
  32. data/spec/fixtures/bulk_send_jobs.json +22 -0
  33. data/spec/hello_sign/api/account_spec.rb +1 -1
  34. data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
  35. data/spec/hello_sign_spec.rb +2 -4
  36. data/spec/spec_helper.rb +0 -2
  37. metadata +11 -3
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,23 +19,21 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Api
27
- #
28
25
  # Contains all the API calls for the Team resource.
29
26
  # Take a look at our API Documentation on the Team Resource (https://app.hellosign.com/api/reference#Team)
30
27
  # for more information about this.
31
28
  #
32
29
  # @author [hellosign]
33
- #
30
+
34
31
  module Team
35
- #
36
- # Returns information about your Team as well as a list of its members.
32
+
33
+ # Returns member list and information about your Team.
37
34
  # If you do not belong to a Team, HelloSign::Error::NotFound will be raised
38
35
  #
39
- # @return [HelloSign::Resource::Team] your current Team
36
+ # @return [HelloSign::Resource::Team] Current Team
40
37
  #
41
38
  # @example
42
39
  # team = @client.get_team
@@ -44,41 +41,39 @@ module HelloSign
44
41
  HelloSign::Resource::Team.new get('/team')
45
42
  end
46
43
 
47
- #
48
- # Creates a new Team and makes you a member. You must not currently belong to a Team to invoke.
44
+ # Creates a new Team and adds you as a member. You must not currently belong to a Team.
49
45
  # @option opts [String] name The name of the Team.
50
46
  #
51
- # @return [HelloSign::Resource::Team] new created Team object
47
+ # @return [HelloSign::Resource::Team] a Team
52
48
  #
53
49
  # @example
54
- # team = @client.create_team :name => 'Team America World Police'
50
+ # team = @client.create_team name: 'Team America World Police'
55
51
  def create_team(opts)
56
- HelloSign::Resource::Team.new post('/team/create', :body => opts)
52
+ HelloSign::Resource::Team.new post('/team/create', body: opts)
57
53
  end
58
54
 
59
- #
60
55
  # Updates the name of your Team.
61
56
  # @option opts [String] name The name of your Team.
62
57
  #
63
- # @return [HelloSign::Resource::Team] a Team object
58
+ # @return [HelloSign::Resource::Team]
64
59
  #
65
60
  # @example
66
- # team = @client.update_team :name => 'New Team Name'
61
+ # team = @client.update_team name: 'New Team Name'
67
62
  def update_team(opts)
68
- HelloSign::Resource::Team.new post('/team', :body => opts)
63
+ HelloSign::Resource::Team.new post('/team', body: opts)
69
64
  end
70
65
 
71
- #
72
66
  # Deletes your Team. Can only be invoked with a Team with one member (yourself).
73
67
  #
68
+ # @return [HTTP::Status] 200 OK
69
+ #
74
70
  # @example
75
71
  # team = @client.destroy_team
76
72
  def destroy_team
77
73
  post('/team/destroy')
78
74
  end
79
75
 
80
- #
81
- # Adds or invites a user (specified using the email_address parameter) to the Team.
76
+ # Adds or invites a user to the Team.
82
77
  # If the user does not currently have a HelloSign Account, a new one will be created for them.
83
78
  # If the user currently has a paid subscription, they will be emailed an invitation to join the Team.
84
79
  # If a user is already a part of a Team, a "team_invite_failed" error will be returned.
@@ -86,26 +81,26 @@ module HelloSign
86
81
  # @option opts [String] email_address The user's email address to invite to your Team.
87
82
  # Note: The account_id prevails if both email_address and acccount_id are provided.
88
83
  #
89
- # @return [HelloSign::Resource::Team] updated Team object
84
+ # @return [HelloSign::Resource::Team] a Team
90
85
  #
91
86
  # @example
92
- # team = @client.add_member_to_team :email_address => 'george@example.com'
87
+ # team = @client.add_member_to_team email_address: 'george@example.com'
93
88
  def add_member_to_team(opts)
94
- HelloSign::Resource::Team.new post('/team/add_member', :body => opts)
89
+ HelloSign::Resource::Team.new post('/team/add_member', body: opts)
95
90
  end
96
91
 
97
- #
98
92
  # Removes a user from the Team. If the user had an outstanding invitation to your Team, the original invitation will expire.
99
93
  # @option opts [String] account_id The user's Account ID to remove from the Team.
100
94
  # @option opts [String] email_address The user's email address to remove from your Team.
101
95
  # @option opts [String] new_owner_email_address The Account's email address to receive all documents, API Apps (if applicable), and API key from removed account. (optional)
102
96
  # Note: The account_id prevails if both email_address and acccount_id are provided.
103
97
  #
104
- # @return [HelloSign::Resource::Team] updated Team object
98
+ # @return [HelloSign::Resource::Team] updated Team
99
+ #
105
100
  # @example
106
- # team = @client.remove_member_from_team :email_address => 'george@example.com'
101
+ # team = @client.remove_member_from_team email_address: 'george@example.com'
107
102
  def remove_member_from_team(opts)
108
- HelloSign::Resource::Team.new post('/team/remove_member', :body => opts)
103
+ HelloSign::Resource::Team.new post('/team/remove_member', body: opts)
109
104
  end
110
105
  end
111
106
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,56 +19,49 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Api
27
-
28
- #
29
25
  # Contains all the API calls for the Template resource.
30
26
  # Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
31
27
  # for more information about this.
32
28
  #
33
29
  # @author [hellosign]
34
- #
30
+
35
31
  module Template
36
32
 
33
+ # Retrieves the Template with the given ID.
34
+ # @option opts [String] template_id The ID of the Template to retrieve.
37
35
  #
38
- # Retrieves the Template specified by the id parameter.
39
- # @option opts [String] template_id The Template ID to retrieve.
40
- #
41
- # @return [HelloSign::Resource::Template] a Template object
36
+ # @return [HelloSign::Resource::Template] a Template
42
37
  #
43
38
  # @example
44
- # template = @client.get_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35'
45
- #
39
+ # template = @client.get_template template_id: 'f57db65d3f933b5316d398057a36176831451a35'
46
40
  def get_template(opts)
47
41
  HelloSign::Resource::Template.new get("/template/#{opts[:template_id]}")
48
42
  end
49
43
 
50
- #
51
44
  # Deletes the specified Template.
52
- # @option opts [String] template_id The Template ID to delete.
45
+ # @option opts [String] template_id The ID of the Template to delete.
53
46
  #
54
- # @example
55
- # template = @client.delete_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35'
47
+ # @return [HTTP::Status] 200 OK
56
48
  #
49
+ # @example
50
+ # template = @client.delete_template template_id: 'f57db65d3f933b5316d398057a36176831451a35'
57
51
  def delete_template(opts)
58
52
  post("/template/delete/#{opts[:template_id]}")
59
53
  end
60
54
 
61
- #
62
55
  # Retrieves the Templates for the accessible by the current user.
63
- #
64
- # @option opts [String] acount_id The Account ID to return Templates for and must be a team member. Use "all" for all team members. Defaults to current account. (optional)
56
+ # @option opts [String] account_id The Account ID to return Templates for. Use "all" for all team members. Defaults to current account. (optional)
65
57
  # @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
66
58
  # @option opts [Integer] page_size Determines the number of Templates returned per page. Defaults to 20. (optional)
67
59
  # @option opts [String] query Search terms and/or fields to filter the Templates. (optional)
68
60
  #
69
- # @return [HelloSign::Resource::ResourceArray] a ResourceArray object
70
- # @example
71
- # templates = @client.get_templates :page => 1
61
+ # @return [HelloSign::Resource::ResourceArray] a ResourceArray
72
62
  #
63
+ # @example
64
+ # templates = @client.get_templates page: 1
73
65
  def get_templates(opts={})
74
66
  path = '/template/list'
75
67
  opts[:query] = create_search_string(opts[:query]) if opts[:query]
@@ -78,44 +70,39 @@ module HelloSign
78
70
  HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template
79
71
  end
80
72
 
81
- #
82
73
  # Gives the specified Account access to a Template. The Account must be part of your Team.
83
- #
84
74
  # @option opts [String] template_id The Template ID to give access to.
85
75
  # @option opts [String] account_id The Account ID to receive access to the Template.
86
76
  # @option opts [String] email_address The email address of the Account to receive access to the Template.
87
77
  # Note: The account_id prevails if both email_address and acccount_id are provided.
88
78
  #
89
- # @return [Template] a Template object
90
- # @example
91
- # templates = @client.add_user_to_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35', :email_address => 'george@example.com'
79
+ # @return [HelloSign::Resource::Template] a Template
92
80
  #
81
+ # @example
82
+ # templates = @client.add_user_to_template template_id: 'f57db65d3f933b5316d398057a36176831451a35', email_address: 'george@example.com'
93
83
  def add_user_to_template(opts)
94
84
  path = "/template/add_user/#{opts[:template_id]}"
95
85
  opts.delete(:template_id)
96
- HelloSign::Resource::Template.new post(path, :body => opts)
86
+ HelloSign::Resource::Template.new post(path, body: opts)
97
87
  end
98
88
 
99
- #
100
89
  # Removes the specified Account access to the specified Template.
101
- #
102
90
  # @option opts [String] template_id The Template ID to remove access to.
103
91
  # @option opts [String] account_id The Account ID to remove access to the Template.
104
92
  # @option opts [String] email_address The email address of the Account to remove access to the Template.
105
93
  # Note: The account_id prevails if both email_address and acccount_id are provided.
106
94
  #
107
- # @return [Template] a Template object
108
- # @example
109
- # templates = @client.remove_user_from_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35', :email_address => 'george@example.com'
95
+ # @return [HelloSign::Resource::Template] a Template
110
96
  #
97
+ # @example
98
+ # templates = @client.remove_user_from_template template_id: 'f57db65d3f933b5316d398057a36176831451a35', email_address: 'george@example.com'
111
99
  def remove_user_from_template(opts)
112
100
  path = "/template/remove_user/#{opts[:template_id]}"
113
101
  opts.delete(:template_id)
114
- HelloSign::Resource::Template.new post(path, :body => opts)
102
+ HelloSign::Resource::Template.new post(path, body: opts)
115
103
  end
116
104
 
117
- #
118
- # Creates a new embedded template draft object that can be launched in an iFrame using the claim_url.
105
+ # Creates a new Embedded Template draft object that can be launched in an iFrame using the claim_url.
119
106
  # @option opts [Boolean] test_mode Indicates if this is a test Template draft. SignatureRequests using this Template will not be legally binding if set to 1. Defaults to 0. (optional)
120
107
  # @option opts [String] client_id The API App Client ID associated with the Template draft. (optional)
121
108
  # @option opts [Array<String>] files 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.
@@ -124,61 +111,83 @@ module HelloSign
124
111
  # @option opts [String] subject The default Template title alias. (optional)
125
112
  # @option opts [String] message The default message in the email that will be sent to the signer(s). (optional)
126
113
  # @option opts [Array<Hash>] signers List of signers displayed when the Template is used to create a SignatureRequest
127
- # * :name (String) Signer role name
128
- # * :order (Integer) The order the signer role is required to sign in. (optional)
114
+ # * name (String) Signer role name
115
+ # * order (Integer) The order the signer role is required to sign in. (optional)
116
+ # @option opts [Array<Hash>] attachments Sets a list of attachments signers can upload
117
+ # * name (String) Attachment name
118
+ # * instructions (String) Instructions for uploading the attachment. (optional)
119
+ # * signer_index (Integer) The signer's unique number.
120
+ # * required (Boolean) Determines if the signer is required to upload this attachment. Defaults to 0. (Optional)
129
121
  # @option opts [Array<Hash>] cc_roles The CC roles that must be assigned when using the Template to create a SignatureRequest. (optional)
130
122
  # @option opts [String<Array><Hash>] merge_fields List of fields that can be pre-populated by your application when using the Template to send a SignatureRequest. (optional)
131
- # * :name (String) Merge field name
132
- # * :type (String) Field type - either "text" or "checkbox"
123
+ # * name (String) Merge field name
124
+ # * type (String) Field type - either "text" or "checkbox"
133
125
  # @option opts [Boolean] skip_me_now Sets the "Me (Now)" option for the Template preparer. Defaults to 0. (optional)
134
126
  # @option opts [Boolean] use_preexisting_fields Sets the detection of predefined PDF fields. Defaults to 0. (optional)
135
127
  # @option opts [Hash] metadata Key-value data attached to the Template and all SignatureRequests created from the Template. (optional)
136
128
  # @option opts [Boolean] allow_reassign Sets the ability for signers to reassign the SignatureRequest to other signers. Defaults to 0. (optional)
137
129
  #
138
- # @example create_embedded_draft
130
+ # @return [HelloSign::Resource::Template] a Template
131
+ #
132
+ # @example
139
133
  # template_draft = @client.create_embedded_template_draft(
140
- # :test_mode => 1,
141
- # :subject => 'The NDA we talked about',
142
- # :requester_email_address => requester@example.com",
143
- # :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
144
- # :signer_roles => [{
145
- # :name => 'Manager',
146
- # :order => 0
147
- # },{
148
- # :name => 'Client',
149
- # :order => 1
134
+ # test_mode: 1,
135
+ # subject: 'The NDA we talked about',
136
+ # requester_email_address: 'requester@example.com',
137
+ # message: 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
138
+ # signer_roles: [
139
+ # {
140
+ # name: 'Manager',
141
+ # order: 0
142
+ # },
143
+ # {
144
+ # name: 'Client',
145
+ # order: 1
150
146
  # }
151
147
  # ],
152
- # :cc_roles => ['HRManager'],
153
- # :files => ['NDA.pdf', 'AppendixA.pdf'],
154
- # :merge_fields => '[{
155
- # :name => 'contract_id',
156
- # :type => 'text'
157
- # },{
158
- # :name => 'purchase_price',
159
- # :order => 'text'
148
+ # attachments: [{
149
+ # name: 'Passport',
150
+ # instructions: 'Upload your US Passport',
151
+ # signer_index: 0,
152
+ # required: true
153
+ # },
154
+ # {
155
+ # name: 'Driver's License',
156
+ # instructions: 'Upload your CA Driver's License',
157
+ # signer_index: 1,
158
+ # required: false
159
+ # }
160
+ # ],
161
+ # cc_roles: ['HRManager'],
162
+ # files: ['NDA.pdf', 'AppendixA.pdf'],
163
+ # merge_fields: '[
164
+ # {
165
+ # name: 'contract_id',
166
+ # type: 'text'
167
+ # },
168
+ # {
169
+ # name: 'purchase_price',
170
+ # order: 'text'
160
171
  # }
161
172
  # ]'
162
173
  # )
163
- #
164
174
  def create_embedded_template_draft(opts)
165
175
  opts[:client_id] ||= self.client_id
166
176
  prepare_files opts
167
177
  prepare_signer_roles opts
168
- HelloSign::Resource::TemplateDraft.new post("/template/create_embedded_draft", :body => opts)
178
+ prepare_attachments opts
179
+ HelloSign::Resource::TemplateDraft.new post("/template/create_embedded_draft", body: opts)
169
180
  end
170
181
 
171
- #
172
182
  # Downloads the original files of a specified Template.
173
- #
174
183
  # @option opts [String] template_id The Template ID to retrieve.
175
184
  # @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)
176
185
  # @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)
177
186
  #
178
187
  # @return a PDF or Zip
179
- # @example
180
- # templates = @client.get_template_files :template_id => 'f57db65d3f933b5316d398057a36176831451a35', :file_type => 'zip'
181
188
  #
189
+ # @example
190
+ # file = @client.get_template_files template_id: 'f57db65d3f933b5316d398057a36176831451a35', file_type: 'zip'
182
191
  def get_template_files(opts)
183
192
  path = "/template/files/#{opts[:template_id]}"
184
193
  if opts[:file_type]
@@ -192,26 +201,26 @@ module HelloSign
192
201
  get(path)
193
202
  end
194
203
 
195
- #
196
204
  # Overlays a new file with the overlay of the specified Template.
197
- #
198
205
  # @option opts [String] template_id The Template ID to update.
199
206
  # @option opts [Array<String>] files 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.
200
207
  # @option opts [Array<String>] file_urls 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.
201
208
  # @option opts [String] subject The updated default Template title alias. (optional)
202
209
  # @option opts [String] message The updated default message in the email that will be sent to the signer(s). (optional)
203
- # @option opts [String] client_id The API App Client ID associated with the Template draft. (optional)
204
- # @option opts [Boolean] test_mode Indicates if this is a test Template draft. SignatureRequests using this Template will not be legally binding if set to 1. Defaults to 0. (optional)
210
+ # @option opts [String] client_id The API App Client ID associated with the Template. (optional)
211
+ # @option opts [Boolean] test_mode Indicates if this is a test Template. SignatureRequests using this Template will not be legally binding if set to 1. Defaults to 0. (optional)
205
212
  #
206
213
  # @return a Template ID
214
+ #
207
215
  # @example
208
- # templates = @client.update_template_files :template_id => 'f57db65d3f933b5316d398057a36176831451a35', :file => '@NDA.pdf'
216
+ # templates = @client.update_template_files template_id: 'f57db65d3f933b5316d398057a36176831451a35', file: '@NDA.pdf'
209
217
  #
210
218
  def update_template_files(opts)
211
219
  template_id = opts.delete(:template_id)
212
220
  path = "/template/update_files/#{template_id}"
213
221
  prepare_files opts
214
- HelloSign::Resource::Template.new post(path, :body => opts)
222
+
223
+ HelloSign::Resource::Template.new post(path, body: opts)
215
224
  end
216
225
  end
217
226
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,41 +19,42 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Api
25
+ # Contains all the API calls for the UnclaimedDraft resource.
26
+ # Take a look at our API documentation for creating UnclaimedDrafts (https://app.hellosign.com/api/reference#UnclaimedDraft)
27
+ # for more information about this.
28
+ #
29
+ # @author [hellosign]
27
30
 
28
- #
29
- # Contains all the API calls for the UnclaimedDraft resource.
30
- # Take a look at our API documentation for creating UnclaimedDrafts (https://app.hellosign.com/api/reference#UnclaimedDraft)
31
- # for more information about this.
32
- #
33
- # @author [hellosign]
34
- #
35
- module UnclaimedDraft
31
+ module UnclaimedDraft
36
32
 
37
- #
38
33
  # Creates a new UnclaimedDraft that can be claimed using the claim_url.
39
34
  # 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.
40
35
  # Subsequent access to the claim_url will result in a 404 not found error.
41
- # @option opts [Boolean] test_mode 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)
42
- # @option opts [Array<String>] files 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.
43
- # @option opts [Array<String>] file_urls 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.
44
- # @option opts [String] type The type of UnclaimedDraft to create. Use "send_document" to create a claimable file, and "request_signature" for a claimable signature request.
36
+ # @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)
37
+ # @option opts [Array<String>] files Specifies the file path(s) to send for the SignatureRequest.
38
+ # @option opts [Array<String>] file_urls Specifies the URL(s) for the file(s) to send for the SignatureRequest.
39
+ # @option opts [String] type The type of UnclaimedDraft to create. Use "send_document" to create a claimable file, and "request_signature" for a claimable SignatureRequest.
45
40
  # * For "send_document," only the file parameter is required.
46
41
  # * For "request_signature," then signer name and email_address are required.
47
42
  # @option opts [String] subject The subject in the email that will be sent to the signer(s). (optional)
48
43
  # @option opts [String] message The custom message in the email that will be sent to the signer(s). (optional)
49
- # @option opts [Array<Hash>] signers List of signers, each item is a Hash with these keys: (optional)
50
- # * :name (String) Signer's name
51
- # * :email_address (String) Signer's email address
52
- # * :order (Integer) The order the signers are required to sign in (optional)
44
+ # @option opts [Array<Hash>] signers Sets a list of signers, each item is a Hash with these keys:
45
+ # * name (String) Signer's name
46
+ # * email_address (String) Signer's email address
47
+ # * order (Integer) The order the signers are required to sign in (optional)
48
+ # @option opts [Array<Hash>] attachments Sets a list of attachments signers can upload
49
+ # * name (String) Attachment name
50
+ # * instructions (String) Instructions for uploading the attachment. (optional)
51
+ # * signer_index (Integer) The signer's unique number.
52
+ # * required (Boolean) Determines if the signer is required to upload this attachment. Defaults to 0. (Optional)
53
53
  # @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)
54
- # * :name (String) Custom field name or "Field Label"
55
- # * :value (String) The value of the field. This data will appear on the SignatureRequest.
56
- # @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed. (optional)
57
- # @option opts [String] signing_redirect_url The URL you want the signer(s) redirected to after they successfully sign. (optional)
54
+ # * name (String) Custom field name or "Field Label"
55
+ # * value (String) The value of the field. This data will appear on the SignatureRequest.
56
+ # @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed on the SignatureRequest. (optional)
57
+ # @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
58
58
  # @option opts [Boolean] use_text_tags Indicates whether the SignatureRequest should have Text Tags enabled. Defaults to 0. (optional)
59
59
  # @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)
60
60
  # @option opts [Boolean] use_preexisting_fields Sets the detection of predefined PDF fields. Defaults to 0. (optional)
@@ -62,71 +62,97 @@ module HelloSign
62
62
  # @option opts [Boolean] allow_decline Allows signers to decline the SignatureRequest. Defaults to 0. (optional)
63
63
  # @option opts [Boolean] allow_reassign Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)
64
64
  # @option opts [Array<Hash>] form_fields_per_document The fields that should appear on the document. (optional)
65
+ # @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
65
66
  #
66
- # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft object
67
+ # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft
67
68
  #
68
69
  # @example type: send_document
69
70
  # unclaimed_draft = @client.create_unclaimed_draft(
70
- # :test_mode => 1,
71
- # :files => ['NDA.pdf', 'AppendixA.pdf']
71
+ # test_mode: 1,
72
+ # files: ['NDA.pdf', 'AppendixA.pdf']
72
73
  # )
74
+ #
73
75
  # @example type: request_signature
74
76
  # unclaimed_draft = @client.create_unclaimed_draft(
75
- # :test_mode => 1,
76
- # :type => 'request_signature',
77
- # :subject => 'The NDA we talked about',
78
- # :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
79
- # :metadata => {
80
- # :client_id => '1234',
81
- # :custom_text => 'NDA #9'
77
+ # test_mode: 1,
78
+ # type: 'request_signature',
79
+ # subject: 'The NDA we talked about',
80
+ # message: 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
81
+ # metadata: {
82
+ # client_id: '1234',
83
+ # custom_text: 'NDA #9'
82
84
  # },
83
- # :signers => [{
84
- # :email_address => 'jack@example.com',
85
- # :name => 'Jack',
86
- # :order => 0
87
- # },{
88
- # :email_address => 'jill@example.com',
89
- # :name => 'Jill',
90
- # :order => 1
85
+ # signers: [
86
+ # {
87
+ # email_address: 'jack@example.com',
88
+ # name: 'Jack',
89
+ # order: 0
90
+ # },
91
+ # {
92
+ # email_address: 'jill@example.com',
93
+ # name: 'Jill',
94
+ # order: 1
91
95
  # }
92
96
  # ],
93
- # :cc_email_addresses => ['lawyer@example.com', 'lawyer@example2.com'],
94
- # :files => ['NDA.pdf', 'AppendixA.pdf']
97
+ # attachments: [{
98
+ # name: 'Passport',
99
+ # instructions: 'Upload your US Passport',
100
+ # signer_index: 0,
101
+ # required: true
102
+ # },
103
+ # {
104
+ # name: 'Driver's License',
105
+ # instructions: 'Upload your CA Driver's License',
106
+ # signer_index: 1,
107
+ # required: false
108
+ # }
109
+ # ],
110
+ # cc_email_addresses: ['lawyer@example.com', 'lawyer@example2.com'],
111
+ # files: ['NDA.pdf', 'AppendixA.pdf'],
112
+ # signing_options: {
113
+ # draw: true,
114
+ # type: true,
115
+ # upload: false,
116
+ # phone: true,
117
+ # default: 'phone'
118
+ # }
95
119
  # )
96
120
  #
97
121
  def create_unclaimed_draft opts
98
122
  prepare_files opts
123
+ prepare_signers opts
99
124
  prepare_form_fields opts
100
125
  prepare_custom_fields opts
126
+ prepare_attachments opts
101
127
 
102
- if opts[:type] == 'request_signature'
103
- prepare_signers opts
104
- end
105
-
106
- HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create', :body => opts)
128
+ HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create', body: opts)
107
129
  end
108
130
 
109
- #
110
- # Creates a new Embedded UnclaimedDraft object that can be launched in an iFrame using the claim_url.
111
- # @option opts [Boolean] test_mode 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)
112
- # @option opts [String] client_id The API App Client ID associated with the UnclaimedDraft.
113
- # @option opts [Array<String>] files 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.
114
- # @option opts [Array<String>] file_urls 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.
131
+ # Creates a new Embedded UnclaimedDraft that can be opened in an embedded iFrame.
132
+ # @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)
133
+ # @option opts [String] client_id The API App Client ID associated with this Embedded UnclaimedDraft.
134
+ # @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.
135
+ # @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.
115
136
  # @option opts [String] requester_email_address The email address of the requester, if "request_signature" type.
116
137
  # @option opts [String] type The type of UnclaimedDraft to create. Use "send_document" to create a claimable file, and "request_signature" for a claimable signature request.
117
138
  # * For "send_document," only the file parameter is required.
118
139
  # * For "request_signature," then signer name and email_address are required.
119
- # @option opts [String] subject The subject in the email that will be sent to the signer(s). (optional)
120
- # @option opts [String] message The custom message in the email that will be sent to the signer(s). (optional)
121
- # @option opts [Array<Hash>] signers List of signers, each item is a Hash with these keys: (optional)
122
- # * :name (String) Signer's name
123
- # * :email_address (String) Signer's email address
124
- # * :order (Integer) The order the signers are required to sign in (optional)
125
- # @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed. (optional)
126
- # @option opts [String] signing_redirect_url The URL you want the signer redirected to after they successfully sign. (optional)
140
+ # @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
141
+ # @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
142
+ # @option opts [Array<Hash>] signers Sets a list of signers, each item is a Hash with these keys:
143
+ # * name (String) Signer's name
144
+ # * email_address (String) Signer's email address
145
+ # * order (Integer) The order the signers are required to sign in (optional)
146
+ # @option opts [Array<Hash>] attachments Sets a list of attachments signers can upload
147
+ # * name (String) Attachment name
148
+ # * instructions (String) Instructions for uploading the attachment. (optional)
149
+ # * signer_index (Integer) The signer's unique number.
150
+ # * required (Boolean) Determines if the signer is required to upload this attachment. Defaults to 0. (Optional)
151
+ # @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed on the SignatureRequest. (optional)
152
+ # @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
127
153
  # @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)
128
- # * :name (String) Custom field name or "Field Label"
129
- # * :value (String) The value of the field. This data will appear on the SignatureRequest.
154
+ # * name (String) Custom field name or "Field Label"
155
+ # * value (String) The value of the field. This data will appear on the SignatureRequest.
130
156
  # @option opts [Boolean] use_text_tags Indicates whether the SignatureRequest should have Text Tags enabled. Defaults to 0. (optional)
131
157
  # @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)
132
158
  # @option opts [Boolean] use_preexisting_fields Sets the detection of predefined PDF fields. Defaults to 0. (optional)
@@ -136,108 +162,134 @@ module HelloSign
136
162
  # @option opts [Boolean] allow_decline Allows signers to decline the SignatureRequest. Defaults to 0. (optional)
137
163
  # @option opts [Boolean] allow_reassign Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)
138
164
  # @option opts [Array<Hash>] form_fields_per_document The fields that should appear on the document. (optional)
165
+ # @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
139
166
  #
140
- # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft object
167
+ # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft
141
168
  #
142
- # @example request_signature
169
+ # @example type: request_signature
143
170
  # unclaimed_draft = @client.create_embedded_unclaimed_draft(
144
- # :test_mode => 1,
145
- # :type => 'request_signature',
146
- # :subject => 'The NDA we talked about',
147
- # :requester_email_address => requester@example.com",
148
- # :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
149
- # :metadata => {
150
- # :client_id => '1234',
151
- # :custom_text => 'NDA #9'
171
+ # test_mode: 1,
172
+ # type: 'request_signature',
173
+ # subject: 'The NDA we talked about',
174
+ # requester_email_address: 'requester@example.com',
175
+ # message: 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
176
+ # metadata: {
177
+ # client_id: '1234',
178
+ # custom_text: 'NDA #9'
152
179
  # },
153
- # :signers => [{
154
- # :email_address => 'jack@example.com',
155
- # :name => 'Jack',
156
- # :order => 0
157
- # },{
158
- # :email_address => 'jill@example.com',
159
- # :name => 'Jill',
160
- # :order => 1
180
+ # signers: [
181
+ # {
182
+ # email_address: 'jack@example.com',
183
+ # name: 'Jack',
184
+ # order: 0
185
+ # },
186
+ # {
187
+ # email_address: 'jill@example.com',
188
+ # name: 'Jill',
189
+ # order: 1
190
+ # }
191
+ # ],
192
+ # attachments: [{
193
+ # name: 'Passport',
194
+ # instructions: 'Upload your US Passport',
195
+ # signer_index: 0,
196
+ # required: true
197
+ # },
198
+ # {
199
+ # name: 'Driver's License',
200
+ # instructions: 'Upload your CA Driver's License',
201
+ # signer_index: 1,
202
+ # required: false
161
203
  # }
162
204
  # ],
163
- # :cc_email_addresses => ['lawyer@example.com', 'lawyer@example2.com'],
164
- # :files => ['NDA.pdf', 'AppendixA.pdf']
205
+ # cc_email_addresses: ['lawyer@example.com', 'lawyer@example2.com'],
206
+ # files: ['NDA.pdf', 'AppendixA.pdf'],
207
+ # signing_options: {
208
+ # draw: true,
209
+ # type: true,
210
+ # upload: false,
211
+ # phone: true,
212
+ # default: 'phone'
213
+ # }
165
214
  # )
166
- #
167
215
  def create_embedded_unclaimed_draft(opts)
168
216
  opts[:client_id] ||= self.client_id
169
217
  prepare_files opts
218
+ prepare_signers opts
170
219
  prepare_form_fields opts
171
220
  prepare_custom_fields opts
221
+ prepare_attachments opts
172
222
 
173
- if opts[:type] == 'request_signature' || opts[:type] == 'send_document'
174
- prepare_signers opts
175
- end
176
-
177
- HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded', :body => opts)
223
+ HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded', body: opts)
178
224
  end
179
225
 
180
- #
181
- # Creates a new Embedded UnclaimedDraft object from a Template that can be launched in an iFrame using the claim_url.
182
- # @option opts [Boolean] test_mode 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)
226
+ # Creates a new Embedded UnclaimedDraft from a Template that can be opened in an embedded iFrame.
227
+ # @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)
183
228
  # @option opts [String] client_id The API App Client ID associated with the UnclaimedDraft.
184
229
  # @option opts [String] template_id The Template ID to use when creating the UnclaimedDraft.
185
230
  # * Use template_ids[%i%] if using multiple templates, replacing %i% with an integer to indicate the order of the Templates
186
231
  # @option opts [String] requester_email_address The email address of the requester, if "request_signature" type.
187
- # @option opts [String] title The title you want to assign to the SignatureRequest. (optional)
188
- # @option opts [String] subject The subject in the email that will be sent to the signer(s). (optional)
189
- # @option opts [String] message The custom message in the email that will be sent to the signer(s). (optional)
232
+ # @option opts [String] title Assigns a title to the SignatureRequest. (optional)
233
+ # @option opts [String] subject Sets the subject in the email sent to the signer(s). (optional)
234
+ # @option opts [String] message Sets the message in the email sent to the signer(s). (optional)
190
235
  # @option opts [Array<Hash>] signers List of signers
191
- # * :role (String) The signer role indicated on the Template. Note that the role name is case sensitive.
192
- # * :name (String) Signer's name
193
- # * :email_address (String) Signer's email address
236
+ # * role (String) The signer role indicated on the Template.
237
+ # * name (String) Signer's name
238
+ # * email_address (String) Signer's email address
194
239
  # @option opts [Array<Hash>] ccs The individual(s) to be CC'd on the SignatureRequest. Required when a CC role exists for the Template.
195
- # * :role (String) The CC role indicated on the Template. Note that the role name is case sensitive.
196
- # * :email_address (String) CC Recipient's email address
197
- # @option opts [String] signing_redirect_url The URL you want the signer redirected to after they successfully sign. (optional)
198
- # @option opts [String] requesting_redirect_url The URL you want the requester redirected to after they successfully request a SignatureRequest. (optional)
240
+ # * role (String) The CC role indicated on the Template. Note that the role name is case sensitive.
241
+ # * email_address (String) CC Recipient's email address
242
+ # @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
243
+ # @option opts [String] requesting_redirect_url Redirects the requester to this URL after sending a SignatureRequest. (optional)
199
244
  # @option opts [Hash] metadata Key-value data attached to the SignatureRequest. (optional)
200
245
  # @option opts [Array<Hash>] custom_fields An array of custom merge fields, representing those present in the Template. (optional)
201
- # * :name (String) Custom field name or "Field Label"
202
- # * :value (String) The value of the field. This data will appear on the SignatureRequest.
203
- # @option opts [Array<String>] files Use files to indicate the uploaded file(s) to append to the SignatureRequest. (optional)
204
- # @option opts [Array<String>] file_urls Use file_urls to have HelloSign download the file(s) to append to the SignatureRequest. (optional)
246
+ # * name (String) Custom field name or "Field Label"
247
+ # * value (String) The value of the field. This data will appear on the SignatureRequest.
248
+ # @option opts [Array<String>] files Specifies the file path(s) to append to the SignatureRequest. (optional)
249
+ # @option opts [Array<String>] file_urls Specifies the URL(s) for the file(s) to append to the SignatureRequest. (optional)
205
250
  # @option opts [Boolean] skip_me_now Disables the "Me (Now)" option for the preparer. Not available for type "send_document." Defaults to 0. (optional)
206
251
  # @option opts [Boolean] allow_decline Allows signers to decline the SignatureRequest. Defaults to 0. (optional)
207
252
  # @option opts [Boolean] allow_reassign Allows signers to reassign the SignatureRequest to another signer. Defaults to 0. (optional)
253
+ # @option opts [Hash] signing_options Specifies the types allowed for creating a signature. (optional)
208
254
  #
209
- # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft object
255
+ # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft
210
256
  #
211
- # @example request_signature
257
+ # @example type: request_signature
212
258
  # unclaimed_draft = @client.create_embedded_unclaimed_draft_with_template(
213
- # :test_mode => 1,
214
- # :subject => 'The NDA we talked about',
215
- # :template_id => 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
216
- # :requester_email_address => requester@example.com",
217
- # :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
218
- # :files => ['NDA.pdf', 'AppendixA.pdf'],
219
- # :metadata => {
220
- # :client_id => '1234',
221
- # :custom_text => 'NDA #9'
259
+ # test_mode: 1,
260
+ # subject: 'The NDA we talked about',
261
+ # template_id: 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
262
+ # requester_email_address: 'requester@example.com',
263
+ # message: 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
264
+ # files: ['NDA.pdf', 'AppendixA.pdf'],
265
+ # metadata: {
266
+ # client_id: '1234',
267
+ # custom_text: 'NDA #9'
222
268
  # },
223
- # :signers => [
269
+ # signers: [
224
270
  # {
225
- # :email_address => 'george@example.com',
226
- # :name => 'George',
227
- # :role => 'Client'
271
+ # email_address: 'george@example.com',
272
+ # name: 'George',
273
+ # role: 'Client'
228
274
  # }
229
275
  # ],
230
- # :ccs => [
276
+ # ccs: [
231
277
  # {
232
- # :email_address =>'accounting@example.com',
233
- # :role => "Accounting"
278
+ # email_address:'accounting@example.com',
279
+ # role: 'Accounting'
234
280
  # }
235
281
  # ],
236
- # :custom_fields => {
237
- # :Cost => '$20,000'
238
- # }
282
+ # custom_fields: {
283
+ # Cost: '$20,000'
284
+ # },
285
+ # signing_options: {
286
+ # draw: true,
287
+ # type: true,
288
+ # upload: false,
289
+ # phone: true,
290
+ # default: 'phone'
291
+ # }
239
292
  # )
240
- #
241
293
  def create_embedded_unclaimed_draft_with_template(opts)
242
294
  opts[:client_id] ||= self.client_id
243
295
  prepare_signers opts
@@ -245,32 +297,31 @@ module HelloSign
245
297
  prepare_ccs opts
246
298
  prepare_templates opts
247
299
  prepare_files opts
248
- HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded_with_template', :body => opts)
300
+
301
+ HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded_with_template', body: opts)
249
302
  end
250
303
 
251
- #
252
- # Creates a new SignatureRequest from an Embedded UnclaimedDraft. This UnclaimedDraft can be
253
- # edited using the claim_url.
304
+ # Creates a new SignatureRequest from an Embedded UnclaimedDraft.
254
305
  # @option opts [String] signature_request_id The SignatureRequest ID to edit and resend.
255
306
  # @option opts [String] client_id The API App Client ID associated with the UnclaimedDraft.
256
- # @option opts [Boolean] test_mode 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)
257
- # @option opts [String] requesting_redirect_url The URL you want the requester redirected to after they successfully request a SignatureRequest. (optional)
258
- # @option opts [String] signing_redirect_url The URL you want the signer redirected to after they successfully sign. (optional)
307
+ # @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)
308
+ # @option opts [String] requesting_redirect_url Redirects the requester to this URL after sending a SignatureRequest. (optional)
309
+ # @option opts [String] signing_redirect_url Redirects the signer(s) to this URL after completing the SignatureRequest. (optional)
259
310
  # @option opts [Boolean] is_for_embedded_signing Enable the UnclaimedDraft to be used for an Embedded SignatureRequest. Defaults to 0. (optional)
260
311
  #
261
- # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft object
312
+ # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft
262
313
  #
263
314
  # @example
264
315
  # unclaimed_draft = @client.edit_and_resend_unclaimed_draft(
265
- # :signature_request_id => '75cdf7dc8b323d43b347e4a3614d1f822bd09491',
266
- # :test_mode => 1,
267
- # :client_id => 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
316
+ # signature_request_id: '75cdf7dc8b323d43b347e4a3614d1f822bd09491',
317
+ # test_mode: 1,
318
+ # client_id: 'b6b8e7deaf8f0b95c029dca049356d4a2cf9710a',
268
319
  # )
269
- #
270
320
  def edit_and_resend_unclaimed_draft(opts)
271
321
  signature_request_id = opts.delete(:signature_request_id)
272
322
  path = "/unclaimed_draft/edit_and_resend/#{signature_request_id}"
273
- HelloSign::Resource::UnclaimedDraft.new post(path, :body => opts)
323
+
324
+ HelloSign::Resource::UnclaimedDraft.new post(path, body: opts)
274
325
  end
275
326
  end
276
327
  end