hellosign-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +15 -0
  5. data/CONTRIBUTING.md +42 -0
  6. data/Gemfile +13 -0
  7. data/Guardfile +14 -0
  8. data/LICENSE +21 -0
  9. data/README.md +112 -0
  10. data/Rakefile +16 -0
  11. data/hellosign-api.gemspec +54 -0
  12. data/lib/hello_sign/.error.rb.swp +0 -0
  13. data/lib/hello_sign/api/account.rb +78 -0
  14. data/lib/hello_sign/api/api_app.rb +121 -0
  15. data/lib/hello_sign/api/bulk_send_job.rb +62 -0
  16. data/lib/hello_sign/api/embedded.rb +68 -0
  17. data/lib/hello_sign/api/oauth.rb +95 -0
  18. data/lib/hello_sign/api/signature_request.rb +691 -0
  19. data/lib/hello_sign/api/team.rb +107 -0
  20. data/lib/hello_sign/api/template.rb +227 -0
  21. data/lib/hello_sign/api/unclaimed_draft.rb +328 -0
  22. data/lib/hello_sign/api.rb +31 -0
  23. data/lib/hello_sign/client.rb +372 -0
  24. data/lib/hello_sign/configuration.rb +78 -0
  25. data/lib/hello_sign/error.rb +99 -0
  26. data/lib/hello_sign/resource/account.rb +43 -0
  27. data/lib/hello_sign/resource/api_app.rb +43 -0
  28. data/lib/hello_sign/resource/base_resource.rb +73 -0
  29. data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
  30. data/lib/hello_sign/resource/embedded.rb +43 -0
  31. data/lib/hello_sign/resource/resource_array.rb +56 -0
  32. data/lib/hello_sign/resource/signature_request.rb +43 -0
  33. data/lib/hello_sign/resource/team.rb +43 -0
  34. data/lib/hello_sign/resource/template.rb +43 -0
  35. data/lib/hello_sign/resource/template_draft.rb +44 -0
  36. data/lib/hello_sign/resource/unclaimed_draft.rb +44 -0
  37. data/lib/hello_sign/resource.rb +33 -0
  38. data/lib/hello_sign/version.rb +25 -0
  39. data/lib/hello_sign.rb +50 -0
  40. data/lib/hellosign-ruby-sdk.rb +4 -0
  41. data/spec/fixtures/account.json +15 -0
  42. data/spec/fixtures/api_app.json +16 -0
  43. data/spec/fixtures/api_apps.json +43 -0
  44. data/spec/fixtures/bulk_send_job.json +88 -0
  45. data/spec/fixtures/bulk_send_jobs.json +22 -0
  46. data/spec/fixtures/embedded.json +6 -0
  47. data/spec/fixtures/empty.pdf +0 -0
  48. data/spec/fixtures/error.json +6 -0
  49. data/spec/fixtures/file.json +0 -0
  50. data/spec/fixtures/headers.json +18 -0
  51. data/spec/fixtures/nda.pdf +0 -0
  52. data/spec/fixtures/signature_request.json +45 -0
  53. data/spec/fixtures/signature_requests.json +44 -0
  54. data/spec/fixtures/team.json +15 -0
  55. data/spec/fixtures/template.json +53 -0
  56. data/spec/fixtures/templates.json +59 -0
  57. data/spec/fixtures/token.json +14 -0
  58. data/spec/fixtures/unclaimed_draft.json +6 -0
  59. data/spec/hello_sign/.error_spec.rb.swp +0 -0
  60. data/spec/hello_sign/api/account_spec.rb +42 -0
  61. data/spec/hello_sign/api/api_app_spec.rb +104 -0
  62. data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
  63. data/spec/hello_sign/api/embedded_spec.rb +23 -0
  64. data/spec/hello_sign/api/oauth_spec.rb +27 -0
  65. data/spec/hello_sign/api/signature_request_spec.rb +268 -0
  66. data/spec/hello_sign/api/team_spec.rb +101 -0
  67. data/spec/hello_sign/api/template_spec.rb +172 -0
  68. data/spec/hello_sign/api/unclaimed_draft_spec.rb +145 -0
  69. data/spec/hello_sign/client_spec.rb +191 -0
  70. data/spec/hello_sign/error_spec.rb +10 -0
  71. data/spec/hello_sign/resource/base_resource_spec.rb +53 -0
  72. data/spec/hello_sign_spec.rb +57 -0
  73. data/spec/scenarios/uploads_spec.rb +19 -0
  74. data/spec/spec_helper.rb +104 -0
  75. metadata +261 -0
@@ -0,0 +1,268 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign::Api::SignatureRequest do
4
+ describe '#get_signature_request' do
5
+ before do
6
+ stub_get('/signature_request/1', 'signature_request')
7
+ @signature_request = HelloSign.get_signature_request :signature_request_id => 1
8
+ end
9
+
10
+ it 'should get the correct resource' do
11
+ expect(a_get('/signature_request/1')).to have_been_made
12
+ end
13
+
14
+ it 'should return response headers' do
15
+ expect(@signature_request.headers).to_not be_nil
16
+ end
17
+
18
+ it 'should return a SignatureRequest' do
19
+ expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
20
+ end
21
+ end
22
+
23
+ describe '#get_signature_requests' do
24
+ before do
25
+ stub_get('/signature_request/list', 'signature_requests')
26
+ @signature_requests = HelloSign.get_signature_requests({})
27
+ end
28
+
29
+ it 'should get the correct resource' do
30
+ expect(a_get('/signature_request/list')).to have_been_made
31
+ end
32
+
33
+ it 'should return response headers' do
34
+ expect(@signature_requests.headers).to_not be_nil
35
+ end
36
+
37
+ it 'should return a SignatureRequestArray' do
38
+ expect(@signature_requests).to be_an HelloSign::Resource::ResourceArray
39
+ end
40
+
41
+ it 'each of Array is an SignatureRequest' do
42
+ expect(@signature_requests[0]).to be_an HelloSign::Resource::SignatureRequest
43
+ end
44
+
45
+ it 'should return list_info as a BaseResource in results' do
46
+ expect(@signature_requests[0].list_info).to be_an HelloSign::Resource::BaseResource
47
+ end
48
+
49
+ it 'should return page numbers as an integer' do
50
+ expect(@signature_requests[0].list_info.page).to be_an Integer
51
+ end
52
+ end
53
+
54
+ describe '#send_signature_request' do
55
+ before do
56
+ stub_post('/signature_request/send', 'signature_request')
57
+ @signature_request = HelloSign.send_signature_request(
58
+ :files_url => ['http://hellosign.com/test.pdf'],
59
+ :signers => ['sss']
60
+ )
61
+ end
62
+
63
+ it 'should get the correct resource' do
64
+ expect(a_post('/signature_request/send')).to have_been_made
65
+ end
66
+
67
+ it 'should return a SignatureRequest' do
68
+ expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
69
+ end
70
+ end
71
+
72
+ describe '#remind_signature_request' do
73
+ before do
74
+ stub_post('/signature_request/remind/1', 'signature_request')
75
+ @signature_request = HelloSign.remind_signature_request(:signature_request_id => 1)
76
+ end
77
+
78
+ it 'should get the correct resource' do
79
+ expect(a_post('/signature_request/remind/1')).to have_been_made
80
+ end
81
+
82
+ it 'should return response headers' do
83
+ expect(@signature_request.headers).to_not be_nil
84
+ end
85
+
86
+ it 'should return response warnings' do
87
+ expect(@signature_request.warnings).to_not be_nil
88
+ end
89
+
90
+ it 'should return a SignatureRequest' do
91
+ expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
92
+ end
93
+ end
94
+
95
+ describe '#cancel_signature_request' do
96
+ before do
97
+ stub_post('/signature_request/cancel/1', 'signature_request')
98
+ @signature_request = HelloSign.cancel_signature_request(:signature_request_id => 1)
99
+ end
100
+
101
+ it 'should get the correct resource' do
102
+ expect(a_post('/signature_request/cancel/1')).to have_been_made
103
+ end
104
+ end
105
+
106
+ describe '#remove_signature_request' do
107
+ before do
108
+ stub_post('/signature_request/remove/1', 'signature_request')
109
+ @signature_request = HelloSign.remove_signature_request(:signature_request_id => 1)
110
+ end
111
+
112
+ it 'should get the correct resource' do
113
+ expect(a_post('/signature_request/remove/1')).to have_been_made
114
+ end
115
+ end
116
+
117
+ describe '#signature_request_files' do
118
+ before do
119
+ stub_get('/signature_request/files/1', 'file')
120
+ @files = HelloSign.signature_request_files(:signature_request_id => 1)
121
+ end
122
+
123
+ it 'should get the correct resource' do
124
+ expect(a_get('/signature_request/files/1')).to have_been_made
125
+ end
126
+ end
127
+
128
+ describe '#signature_request_files with options' do
129
+ describe ':get_url' do
130
+ before do
131
+ stub_get('/signature_request/files/1?get_url=true', 'file')
132
+ @files = HelloSign.signature_request_files(:signature_request_id => 1, :get_url => true)
133
+ end
134
+
135
+ it 'should get the correct resource' do
136
+ expect(a_get('/signature_request/files/1?get_url=true')).to have_been_made
137
+ end
138
+ end
139
+
140
+ describe ':file_type' do
141
+ before do
142
+ stub_get('/signature_request/files/1?file_type=pdf', 'file')
143
+ @files = HelloSign.signature_request_files(:signature_request_id => 1, :file_type => 'pdf')
144
+ end
145
+
146
+ it 'should get the correct resource' do
147
+ expect(a_get('/signature_request/files/1?file_type=pdf')).to have_been_made
148
+ end
149
+ end
150
+
151
+ describe ':file_type and :get_url' do
152
+ before do
153
+ stub_get('/signature_request/files/1?file_type=pdf&get_url=true', 'file')
154
+ @files = HelloSign.signature_request_files(:signature_request_id => 1, :file_type => 'pdf', :get_url => true)
155
+ end
156
+
157
+ it 'should get the correct resource' do
158
+ expect(a_get('/signature_request/files/1?file_type=pdf&get_url=true')).to have_been_made
159
+ end
160
+ end
161
+ end
162
+
163
+ describe '#send_signature_request_with_template' do
164
+ before do
165
+ stub_post('/signature_request/send_with_template', 'signature_request')
166
+ @signature_request = HelloSign.send_signature_request_with_template({})
167
+ end
168
+
169
+ it 'should get the correct resource' do
170
+ expect(a_post('/signature_request/send_with_template')).to have_been_made
171
+ end
172
+
173
+ it 'should return response headers' do
174
+ expect(@signature_request.headers).to_not be_nil
175
+ end
176
+ end
177
+
178
+ describe '#create_embedded_signature_request' do
179
+ before do
180
+ stub_post('/signature_request/create_embedded', 'signature_request')
181
+ @signature_request = HelloSign.create_embedded_signature_request({})
182
+ end
183
+
184
+ it 'should get the correct resource' do
185
+ expect(a_post('/signature_request/create_embedded')).to have_been_made
186
+ end
187
+
188
+ it 'should return response headers' do
189
+ expect(@signature_request.headers).to_not be_nil
190
+ end
191
+ end
192
+
193
+ describe '#create_embedded_signature_request_with_template' do
194
+ before do
195
+ stub_post('/signature_request/create_embedded_with_template', 'signature_request')
196
+ @signature_request = HelloSign.create_embedded_signature_request_with_template({})
197
+ end
198
+
199
+ it 'should get the correct resource' do
200
+ expect(a_post('/signature_request/create_embedded_with_template')).to have_been_made
201
+ end
202
+
203
+ it 'should return response headers' do
204
+ expect(@signature_request.headers).to_not be_nil
205
+ end
206
+ end
207
+
208
+ describe '#release_on_hold_signature_request' do
209
+ before do
210
+ stub_post('/signature_request/release_hold/1', 'signature_request')
211
+ @signature_request = HelloSign.release_on_hold_signature_request(:signature_request_id => 1)
212
+ end
213
+
214
+ it 'should get the correct resource' do
215
+ expect(a_post('/signature_request/release_hold/1')).to have_been_made
216
+ end
217
+
218
+ it 'should return response headers' do
219
+ expect(@signature_request.headers).to_not be_nil
220
+ end
221
+
222
+ it 'should return a SignatureRequest' do
223
+ expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
224
+ end
225
+ end
226
+
227
+ describe '#update_signature_request' do
228
+ before do
229
+ stub_post('/signature_request/update/1', 'signature_request')
230
+ @signature_request = HelloSign.update_signature_request(
231
+ :signature_request_id => '1',
232
+ :signature_id => 'signature_id',
233
+ :email_address => 'updated_signer_email_address@example.com'
234
+ )
235
+ end
236
+
237
+ it 'should get the correct resource' do
238
+ expect(a_post('/signature_request/update/1')).to have_been_made
239
+ end
240
+
241
+ it 'should return response headers' do
242
+ expect(@signature_request.headers).to_not be_nil
243
+ end
244
+
245
+ it 'should return a Signature Request' do
246
+ expect(@signature_request).to be_a HelloSign::Resource::SignatureRequest
247
+ end
248
+ end
249
+
250
+ describe '#release_hold_signature_request' do
251
+ before do
252
+ stub_post('/signature_request/release_hold/1', 'signature_request')
253
+ @signature_request = HelloSign.release_hold_signature_request(:signature_request_id => 1)
254
+ end
255
+
256
+ it 'should get the correct resource' do
257
+ expect(a_post('/signature_request/release_hold/1')).to have_been_made
258
+ end
259
+
260
+ it 'should return response headers' do
261
+ expect(@signature_request.headers).to_not be_nil
262
+ end
263
+
264
+ it 'should return a SignatureRequest' do
265
+ expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
266
+ end
267
+ end
268
+ end
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign::Api::Team do
4
+ describe '#get_team' do
5
+ before do
6
+ stub_get('/team', 'team')
7
+ @team = HelloSign.get_team
8
+ end
9
+
10
+ it 'should get the correct resource' do
11
+ expect(a_get('/team')).to have_been_made
12
+ end
13
+
14
+ it 'should return response headers' do
15
+ expect(@team.headers).to_not be_nil
16
+ end
17
+
18
+ it 'should return user\'s team' do
19
+ expect(@team).to be_an HelloSign::Resource::Team
20
+ end
21
+ end
22
+
23
+ describe '#create_team' do
24
+ before do
25
+ stub_post('/team/create', 'team')
26
+ @team = HelloSign.create_team :name => 'Team HelloSign'
27
+ end
28
+
29
+ it 'should get the correct resource' do
30
+ expect(a_post('/team/create')).to have_been_made
31
+ end
32
+
33
+ it 'should return response headers' do
34
+ expect(@team.headers).to_not be_nil
35
+ end
36
+
37
+ it 'should return information about a created team' do
38
+ expect(@team.name).to eql('Team HelloSign')
39
+ end
40
+ end
41
+
42
+ describe '#update_team' do
43
+ before do
44
+ stub_post('/team', 'team')
45
+ @team = HelloSign.update_team :name => 'Team HelloSign'
46
+ end
47
+
48
+ it 'should get the correct resource' do
49
+ expect(a_post('/team')).to have_been_made
50
+ end
51
+
52
+ it 'should return response headers' do
53
+ expect(@team.headers).to_not be_nil
54
+ end
55
+
56
+ it 'should return information about a updated team' do
57
+ expect(@team.name).to eql('Team HelloSign')
58
+ end
59
+ end
60
+
61
+ describe '#destroy_team' do
62
+ before do
63
+ stub_post('/team/destroy', 'team')
64
+ @team = HelloSign.destroy_team
65
+ end
66
+
67
+ it 'should get the correct resource' do
68
+ expect(a_post('/team/destroy')).to have_been_made
69
+ end
70
+ end
71
+
72
+ describe '#add_member_to_team' do
73
+ before do
74
+ stub_post('/team/add_member', 'team')
75
+ @team = HelloSign.add_member_to_team :email_address => 'george@example.com'
76
+ end
77
+
78
+ it 'should return response headers' do
79
+ expect(@team.headers).to_not be_nil
80
+ end
81
+
82
+ it 'should get the correct resource' do
83
+ expect(a_post('/team/add_member')).to have_been_made
84
+ end
85
+ end
86
+
87
+ describe '#remove_member_from_team' do
88
+ before do
89
+ stub_post('/team/remove_member', 'team')
90
+ @team = HelloSign.remove_member_from_team :email_address => 'george@example.com'
91
+ end
92
+
93
+ it 'should return response headers' do
94
+ expect(@team.headers).to_not be_nil
95
+ end
96
+
97
+ it 'should get the correct resource' do
98
+ expect(a_post('/team/remove_member')).to have_been_made
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,172 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign::Api::Template do
4
+ describe '#get_template' do
5
+ before do
6
+ stub_get('/template/1', 'template')
7
+ @template = HelloSign.get_template :template_id => 1
8
+ end
9
+
10
+ it 'should get the correct resource' do
11
+ expect(a_get('/template/1')).to have_been_made
12
+ end
13
+
14
+ it 'should return response headers' do
15
+ expect(@template.headers).to_not be_nil
16
+ end
17
+
18
+ it 'should return a Template' do
19
+ expect(@template).to be_an HelloSign::Resource::Template
20
+ end
21
+ end
22
+
23
+ describe '#get_templates' do
24
+ before do
25
+ stub_get('/template/list', 'templates')
26
+ @template = HelloSign.get_templates({})
27
+ end
28
+
29
+ it 'should get the correct resource' do
30
+ expect(a_get('/template/list')).to have_been_made
31
+ end
32
+
33
+ it 'returns reponse headers' do
34
+ expect(@template.headers).to_not be_nil
35
+ end
36
+
37
+ it 'should return a ResourceArray' do
38
+ expect(@template).to be_an HelloSign::Resource::ResourceArray
39
+ end
40
+
41
+ it 'each of Array is an Template' do
42
+ expect(@template[0]).to be_an HelloSign::Resource::Template
43
+ end
44
+
45
+ it 'should return list_info as a BaseResource in results' do
46
+ expect(@template[0].list_info).to be_an HelloSign::Resource::BaseResource
47
+ end
48
+
49
+ it 'should return page numbers as an integer' do
50
+ expect(@template[0].list_info.page).to be_an Integer
51
+ end
52
+ end
53
+
54
+ describe '#add_user_to_template' do
55
+ before do
56
+ stub_post('/template/add_user/1', 'template')
57
+ @template = HelloSign.add_user_to_template :template_id => 1
58
+ end
59
+
60
+ it 'should get the correct resource' do
61
+ expect(a_post('/template/add_user/1')).to have_been_made
62
+ end
63
+
64
+ it 'should return response headers' do
65
+ expect(@template.headers).to_not be_nil
66
+ end
67
+
68
+ it 'should return a Template' do
69
+ expect(@template).to be_an HelloSign::Resource::Template
70
+ end
71
+ end
72
+
73
+ describe '#remove_user_from_template' do
74
+ before do
75
+ stub_post('/template/remove_user/1', 'template')
76
+ @template = HelloSign.remove_user_from_template :template_id => 1
77
+ end
78
+
79
+ it 'should get the correct resource' do
80
+ expect(a_post('/template/remove_user/1')).to have_been_made
81
+ end
82
+
83
+ it 'should return response headers' do
84
+ expect(@template.headers).to_not be_nil
85
+ end
86
+
87
+ it 'should return a Template' do
88
+ expect(@template).to be_an HelloSign::Resource::Template
89
+ end
90
+ end
91
+
92
+ describe '#get_template_files' do
93
+ before do
94
+ stub_get('/template/files/1', 'file')
95
+ @files = HelloSign.get_template_files :template_id => 1
96
+ end
97
+
98
+ it 'should get the correct resource' do
99
+ expect(a_get('/template/files/1')).to have_been_made
100
+ end
101
+
102
+ it 'should return response headers' do
103
+ expect(@files[:headers]).to_not be_nil
104
+ end
105
+ end
106
+
107
+ describe '#get_template_files with options' do
108
+ describe ':get_url' do
109
+ before do
110
+ stub_get('/template/files/1?get_url=true', 'file')
111
+ @files = HelloSign.get_template_files :template_id => 1, :get_url => true
112
+ end
113
+
114
+ it 'should get the correct resource' do
115
+ expect(a_get('/template/files/1?get_url=true')).to have_been_made
116
+ end
117
+
118
+ it 'should return response headers' do
119
+ expect(@files[:headers]).to_not be_nil
120
+ end
121
+ end
122
+
123
+ describe ':file_type' do
124
+ before do
125
+ stub_get('/template/files/1?file_type=pdf', 'file')
126
+ @files = HelloSign.get_template_files :template_id => 1, :file_type => 'pdf'
127
+ end
128
+
129
+ it 'should get the correct resource' do
130
+ expect(a_get('/template/files/1?file_type=pdf')).to have_been_made
131
+ end
132
+
133
+ it 'should return response headers' do
134
+ expect(@files[:headers]).to_not be_nil
135
+ end
136
+ end
137
+
138
+ describe ':file_type and :get_url' do
139
+ before do
140
+ stub_get('/template/files/1?file_type=pdf&get_url=true', 'file')
141
+ @files = HelloSign.get_template_files :template_id => 1, :file_type => 'pdf', :get_url => true
142
+ end
143
+
144
+ it 'should get the correct resource' do
145
+ expect(a_get('/template/files/1?file_type=pdf&get_url=true')).to have_been_made
146
+ end
147
+
148
+ it 'should return response headers' do
149
+ expect(@files[:headers]).to_not be_nil
150
+ end
151
+ end
152
+ end
153
+
154
+ describe '#update_template_files' do
155
+ before do
156
+ stub_post('/template/update_files/1', 'template')
157
+ @template = HelloSign.update_template_files :template_id => 1, :file_url => 'http://hellosign.com/test.pdf'
158
+ end
159
+
160
+ it 'should return a Template' do
161
+ expect(@template).to be_an HelloSign::Resource::Template
162
+ end
163
+
164
+ it 'should get the correct resource' do
165
+ expect(a_post('/template/update_files/1')).to have_been_made
166
+ end
167
+
168
+ it 'should return response headers' do
169
+ expect(@template.headers).to_not be_nil
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,145 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign::Api::UnclaimedDraft do
4
+ describe '#create_unclaimed_draft' do
5
+ context 'send_document' do
6
+ before do
7
+ stub_post('/unclaimed_draft/create', 'unclaimed_draft')
8
+ @unclaimed_draft = HelloSign.create_unclaimed_draft({ :type => 'send_document' })
9
+ end
10
+
11
+ it 'should get the correct resource' do
12
+ expect(a_post('/unclaimed_draft/create')).to have_been_made
13
+ end
14
+
15
+ it 'should return response headers' do
16
+ expect(@unclaimed_draft.headers).to_not be_nil
17
+ end
18
+
19
+ it 'should return a UnclaimedDraft' do
20
+ expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
21
+ end
22
+ end
23
+
24
+ context 'request_signature' do
25
+ before do
26
+ stub_post('/unclaimed_draft/create', 'unclaimed_draft')
27
+ @unclaimed_draft = HelloSign.create_unclaimed_draft({ :type => 'request_signature' })
28
+ end
29
+
30
+ it 'should get the correct resource' do
31
+ expect(a_post('/unclaimed_draft/create')).to have_been_made
32
+ end
33
+
34
+ it 'should return response headers' do
35
+ expect(@unclaimed_draft.headers).to_not be_nil
36
+ end
37
+
38
+ it 'should return a UnclaimedDraft' do
39
+ expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
40
+ end
41
+ end
42
+
43
+ context 'edit_and_resend' do
44
+ before do
45
+ stub_post('/unclaimed_draft/edit_and_resend/1', 'unclaimed_draft')
46
+ @unclaimed_draft = HelloSign.edit_and_resend_unclaimed_draft(
47
+ :signature_request_id => '1',
48
+ :client_id => '5e365c014bea2e9a05a9d0834f3e7ca4'
49
+ )
50
+ end
51
+
52
+ it 'should get the correct resource' do
53
+ expect(a_post('/unclaimed_draft/edit_and_resend/1')).to have_been_made
54
+ end
55
+
56
+ it 'should return response headers' do
57
+ expect(@unclaimed_draft.headers).to_not be_nil
58
+ end
59
+
60
+ it 'should return an UnclaimedDraft response' do
61
+ expect(@unclaimed_draft).to be_a HelloSign::Resource::UnclaimedDraft
62
+ end
63
+ end
64
+ end
65
+
66
+ describe '#create_embedded_unclaimed_draft' do
67
+ context 'send_document' do
68
+ before do
69
+ stub_post('/unclaimed_draft/create_embedded', 'unclaimed_draft')
70
+ @unclaimed_draft = HelloSign.create_embedded_unclaimed_draft({ :type => 'send_document' })
71
+ end
72
+
73
+ it 'should get the correct resource' do
74
+ expect(a_post('/unclaimed_draft/create_embedded')).to have_been_made
75
+ end
76
+
77
+ it 'should return response headers' do
78
+ expect(@unclaimed_draft.headers).to_not be_nil
79
+ end
80
+
81
+ it 'should return a UnclaimedDraft' do
82
+ expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
83
+ end
84
+ end
85
+
86
+ context 'request_signature' do
87
+ before do
88
+ stub_post('/unclaimed_draft/create_embedded', 'unclaimed_draft')
89
+ @unclaimed_draft = HelloSign.create_embedded_unclaimed_draft({ :type => 'request_signature' })
90
+ end
91
+
92
+ it 'should get the correct resource' do
93
+ expect(a_post('/unclaimed_draft/create_embedded')).to have_been_made
94
+ end
95
+
96
+ it 'should return response headers' do
97
+ expect(@unclaimed_draft.headers).to_not be_nil
98
+ end
99
+
100
+ it 'should return a UnclaimedDraft' do
101
+ expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
102
+ end
103
+ end
104
+ end
105
+
106
+ describe '#create_embedded_unclaimed_draft_with_template' do
107
+ context 'send_document' do
108
+ before do
109
+ stub_post('/unclaimed_draft/create_embedded_with_template', 'unclaimed_draft')
110
+ @unclaimed_draft = HelloSign.create_embedded_unclaimed_draft_with_template({})
111
+ end
112
+
113
+ it 'should get the correct resource' do
114
+ expect(a_post('/unclaimed_draft/create_embedded_with_template')).to have_been_made
115
+ end
116
+
117
+ it 'should return response headers' do
118
+ expect(@unclaimed_draft.headers).to_not be_nil
119
+ end
120
+
121
+ it 'should return a UnclaimedDraft' do
122
+ expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
123
+ end
124
+ end
125
+
126
+ context 'request_signature' do
127
+ before do
128
+ stub_post('/unclaimed_draft/create_embedded_with_template', 'unclaimed_draft')
129
+ @unclaimed_draft = HelloSign.create_embedded_unclaimed_draft_with_template({})
130
+ end
131
+
132
+ it 'should get the correct resource' do
133
+ expect(a_post('/unclaimed_draft/create_embedded_with_template')).to have_been_made
134
+ end
135
+
136
+ it 'should return response headers' do
137
+ expect(@unclaimed_draft.headers).to_not be_nil
138
+ end
139
+
140
+ it 'should return a UnclaimedDraft' do
141
+ expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
142
+ end
143
+ end
144
+ end
145
+ end