docusign_webforms 1.0.2.rc12 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +94 -130
- data/docusign_webforms.gemspec +1 -1
- data/lib/docusign_webforms/api/form_instance_management_api.rb +4 -4
- data/lib/docusign_webforms/api/form_management_api.rb +2 -2
- data/lib/docusign_webforms/client/api_client.rb +7 -9
- data/lib/docusign_webforms/client/auth/oauth.rb +0 -2
- data/lib/docusign_webforms/configuration.rb +4 -4
- data/lib/docusign_webforms/models/authentication_method.rb +27 -157
- data/lib/docusign_webforms/models/create_instance_request_body.rb +1 -1
- data/lib/docusign_webforms/models/instance_source.rb +1 -0
- data/lib/docusign_webforms/models/instance_status.rb +1 -0
- data/lib/docusign_webforms/models/web_form.rb +11 -1
- data/lib/docusign_webforms/models/web_form_metadata.rb +22 -2
- data/lib/docusign_webforms/models/web_form_source.rb +1 -0
- data/lib/docusign_webforms/models/web_form_summary.rb +11 -1
- data/lib/docusign_webforms/models/web_form_type.rb +29 -0
- data/lib/docusign_webforms/version.rb +1 -1
- data/lib/docusign_webforms.rb +2 -0
- data/tests/Gemfile +1 -0
- data/tests/docs/private.pem +1 -0
- data/tests/spec/unit_tests_using_jwt_spec.rb +551 -26
- metadata +5 -3
@@ -1,38 +1,563 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
require "docusign_webforms"
|
2
|
+
require "base64"
|
3
|
+
require "uri"
|
4
|
+
require "date"
|
5
|
+
|
6
|
+
|
7
|
+
describe "DocuSign Ruby Client Tests" do
|
8
|
+
def login
|
9
|
+
begin
|
10
|
+
if $api_client.nil?
|
11
|
+
configuration = DocuSign_WebForms::Configuration.new
|
12
|
+
configuration.host = $host
|
13
|
+
|
14
|
+
$api_client = DocuSign_WebForms::ApiClient.new(configuration)
|
15
|
+
$api_client.set_oauth_base_path(DocuSign_WebForms::OAuth::DEMO_OAUTH_BASE_PATH)
|
16
|
+
end
|
17
|
+
|
18
|
+
decode_base64_content = Base64.decode64(ENV["PRIVATE_KEY"])
|
19
|
+
|
20
|
+
File.open($private_key_filename, "wb") do |f|
|
21
|
+
f.write(decode_base64_content)
|
22
|
+
end
|
23
|
+
scopes = [DocuSign_WebForms::OAuth::SCOPE_IMPERSONATION, DocuSign_WebForms::OAuth::SCOPE_SIGNATURE, "webforms_read", "webforms_write", "webforms_instance_read", "webforms_instance_write"]
|
24
|
+
token_obj = $api_client.request_jwt_user_token(ENV["INTEGRATOR_KEY_JWT"], ENV["USER_ID"], File.read($private_key_filename), $expires_in_seconds, scopes)
|
25
|
+
user_info = $api_client.get_user_info(token_obj.access_token)
|
13
26
|
|
14
|
-
|
15
|
-
|
27
|
+
if !user_info.nil?
|
28
|
+
user_info.accounts.each do |account|
|
29
|
+
if account.is_default == "true"
|
30
|
+
account_id = account.account_id
|
31
|
+
$api_client.set_base_path("https://apps-d.docusign.com/api/webforms")
|
32
|
+
return account
|
33
|
+
end
|
16
34
|
end
|
35
|
+
end
|
36
|
+
rescue => e
|
37
|
+
puts "Error during processing: #{$!}"
|
17
38
|
end
|
18
|
-
|
19
|
-
|
39
|
+
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_api_client
|
20
44
|
if $api_client.nil?
|
21
|
-
|
45
|
+
self.login()
|
22
46
|
end
|
23
47
|
|
24
48
|
return $api_client
|
49
|
+
end
|
50
|
+
|
51
|
+
before(:all) do
|
52
|
+
# run before each test
|
53
|
+
$host = "apps-d.docusign.com"
|
54
|
+
|
55
|
+
$expires_in_seconds = 3600 #1 hour
|
56
|
+
$auth_server = "account-d.docusign.com"
|
57
|
+
$private_key_filename = "../docs/private.pem"
|
58
|
+
|
59
|
+
$recipient_name = "Ruby SDK"
|
60
|
+
|
61
|
+
# Required for embedded signing url
|
62
|
+
$client_user_id = ENV["USER_ID"]
|
63
|
+
$integrator_key = ENV["INTEGRATOR_KEY_JWT"]
|
64
|
+
$secret = ENV["SECRET"]
|
65
|
+
$return_url = "https://developers.docusign.com/"
|
66
|
+
$authentication_method = "email"
|
67
|
+
|
68
|
+
$template_id = ""
|
69
|
+
|
70
|
+
$base_uri = nil
|
71
|
+
$account_id = nil
|
72
|
+
$api_client = nil
|
73
|
+
$form_id = nil
|
74
|
+
$client_user_id = nil
|
75
|
+
$instance_id = nil
|
76
|
+
login()
|
77
|
+
end
|
78
|
+
|
79
|
+
after do
|
80
|
+
# run after each test
|
81
|
+
end
|
82
|
+
|
83
|
+
describe DocuSign_WebForms::OAuth do
|
84
|
+
describe ".login" do
|
85
|
+
context "given correct credentials" do
|
86
|
+
it "return Account" do
|
87
|
+
account = login()
|
88
|
+
|
89
|
+
if !account.nil?
|
90
|
+
$base_uri = "https://apps-d.docusign.com/api/webforms"
|
91
|
+
$account_id = account.account_id
|
92
|
+
end
|
93
|
+
|
94
|
+
expect($account_id).to be_truthy
|
95
|
+
end
|
96
|
+
end
|
25
97
|
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe DocuSign_WebForms::FormManagementApi do
|
101
|
+
|
102
|
+
describe ".ListForms" do
|
103
|
+
context "given account id" do
|
104
|
+
it "return forms" do
|
105
|
+
api_client = create_api_client()
|
106
|
+
form_management = DocuSign_WebForms::FormManagementApi.new(api_client)
|
107
|
+
list_forms = form_management.list_forms($account_id)
|
26
108
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
109
|
+
# Ensure that the response from list_forms is correctly structured
|
110
|
+
if list_forms.is_a?(DocuSign_WebForms::WebFormSummaryList)
|
111
|
+
web_form_summary_list = list_forms
|
112
|
+
|
113
|
+
# Check if there are items in the list
|
114
|
+
if web_form_summary_list.items.any?
|
115
|
+
web_form_summary_list.items.each do |web_form_summary|
|
116
|
+
expect(web_form_summary.id).to be_truthy
|
117
|
+
expect(web_form_summary.account_id).to be_truthy
|
118
|
+
expect(web_form_summary.is_published).not_to be_nil
|
119
|
+
expect(web_form_summary.is_enabled).not_to be_nil
|
120
|
+
if web_form_summary.is_enabled == true
|
121
|
+
$form_id = web_form_summary.id
|
122
|
+
break # Exit loop once the first enabled form is found
|
123
|
+
end
|
124
|
+
end
|
125
|
+
else
|
126
|
+
puts "No web form summaries found."
|
35
127
|
end
|
36
|
-
|
128
|
+
else
|
129
|
+
puts "Error: Unexpected response format from list_forms."
|
130
|
+
end
|
131
|
+
expect(list_forms).to be_truthy
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
describe ".GetForm" do
|
136
|
+
context "given account id and form id" do
|
137
|
+
it "return form" do
|
138
|
+
api_client = create_api_client()
|
139
|
+
form_management = DocuSign_WebForms::FormManagementApi.new(api_client)
|
140
|
+
form_options = DocuSign_WebForms::GetFormOptions.new
|
141
|
+
form_options.state = "active"
|
142
|
+
get_form = form_management.get_form($account_id, $form_id, form_options)
|
143
|
+
# Ensure that the response from list_forms is correctly structured
|
144
|
+
if get_form.is_a?(DocuSign_WebForms::WebForm)
|
145
|
+
web_form = get_form
|
146
|
+
|
147
|
+
expect(web_form.id).to be_truthy
|
148
|
+
expect(web_form.id).to eq ($form_id)
|
149
|
+
expect(web_form.account_id).to be_truthy
|
150
|
+
expect(web_form.account_id).to eq($account_id)
|
151
|
+
expect(web_form.is_published).not_to be_nil
|
152
|
+
expect(web_form.is_enabled).not_to be_nil
|
153
|
+
expect(web_form.form_state).not_to be_nil
|
154
|
+
expect(web_form.form_metadata).not_to be_nil
|
155
|
+
else
|
156
|
+
puts "Error: Unexpected response format from get_form."
|
157
|
+
pending "There is error in the API data"
|
158
|
+
end
|
159
|
+
expect(get_form).to be_truthy
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Negative testing
|
165
|
+
describe ".ListForms" do
|
166
|
+
context "given wrong account id" do
|
167
|
+
it "should throw API Error" do
|
168
|
+
api_client = create_api_client()
|
169
|
+
form_management = DocuSign_WebForms::FormManagementApi.new(api_client)
|
170
|
+
wrong_account_id = "abc123"
|
171
|
+
expect {
|
172
|
+
list_forms = form_management.list_forms(wrong_account_id)
|
173
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
describe ".GetForm" do
|
179
|
+
context "given wrong account id and wrong form id" do
|
180
|
+
it "should throw API Error" do
|
181
|
+
api_client = create_api_client()
|
182
|
+
form_management = DocuSign_WebForms::FormManagementApi.new(api_client)
|
183
|
+
wrong_account_id = "abc123"
|
184
|
+
wrong_form_id = "xyz123"
|
185
|
+
expect {
|
186
|
+
get_form = form_management.get_form(wrong_account_id, wrong_form_id)
|
187
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
context "given correct account id and wrong form id" do
|
191
|
+
it "should throw API Error" do
|
192
|
+
api_client = create_api_client()
|
193
|
+
form_management = DocuSign_WebForms::FormManagementApi.new(api_client)
|
194
|
+
wrong_form_id = "xyz123"
|
195
|
+
expect {
|
196
|
+
get_form = form_management.get_form($account_id, wrong_form_id)
|
197
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
context "given wrong account id and correct form id" do
|
201
|
+
it "should throw API Error" do
|
202
|
+
api_client = create_api_client()
|
203
|
+
form_management = DocuSign_WebForms::FormManagementApi.new(api_client)
|
204
|
+
wrong_account_id = "abc123"
|
205
|
+
expect {
|
206
|
+
get_form = form_management.get_form(wrong_account_id, $form_id)
|
207
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
describe DocuSign_WebForms::FormInstanceManagementApi do
|
215
|
+
|
216
|
+
describe ".CreateInstance" do
|
217
|
+
context "given account id, form id, and instance body" do
|
218
|
+
it "creates instance" do
|
219
|
+
api_client = create_api_client()
|
220
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
221
|
+
instance_body = DocuSign_WebForms::CreateInstanceRequestBody.new
|
222
|
+
now = DateTime.now
|
223
|
+
client_id = "asif.sajjad-#{now}"
|
224
|
+
$client_user_id = client_id
|
225
|
+
instance_body.client_user_id = client_id
|
226
|
+
instance_body.tags = ["general_details"]
|
227
|
+
form_instance = form_instance_management.create_instance($account_id, $form_id, instance_body)
|
228
|
+
|
229
|
+
# Ensure that the response from list_forms is correctly structured
|
230
|
+
if form_instance.is_a?(DocuSign_WebForms::WebFormInstance)
|
231
|
+
web_form_instance = form_instance
|
232
|
+
$instance_id = web_form_instance.id
|
233
|
+
expect(web_form_instance.id).to be_truthy
|
234
|
+
expect(web_form_instance.form_id).to eq ($form_id)
|
235
|
+
expect(web_form_instance.account_id).to be_truthy
|
236
|
+
expect(web_form_instance.account_id).to eq($account_id)
|
237
|
+
expect(web_form_instance.form_url).not_to be_nil
|
238
|
+
expect(web_form_instance.instance_token).not_to be_nil
|
239
|
+
expect(web_form_instance.token_expiration_date_time).not_to be_nil
|
240
|
+
else
|
241
|
+
puts "Error: Unexpected response format from form_instance."
|
242
|
+
pending "Unexpected response in create form_instance other than WebformInstance"
|
243
|
+
end
|
244
|
+
expect(form_instance).to be_truthy
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
describe ".GetInstance" do
|
250
|
+
context "given account id, form id, and instance id" do
|
251
|
+
it "get instance" do
|
252
|
+
api_client = create_api_client()
|
253
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
254
|
+
form_instance = form_instance_management.get_instance($account_id, $form_id, $instance_id)
|
255
|
+
|
256
|
+
# Ensure that the response from list_forms is correctly structured
|
257
|
+
if form_instance.is_a?(DocuSign_WebForms::WebFormInstance)
|
258
|
+
web_form_instance = form_instance
|
259
|
+
expect(web_form_instance.id).to be_truthy
|
260
|
+
expect(web_form_instance.form_id).to eq ($form_id)
|
261
|
+
expect(web_form_instance.account_id).to be_truthy
|
262
|
+
expect(web_form_instance.status).to be_truthy
|
263
|
+
expect(web_form_instance.account_id).to eq($account_id)
|
264
|
+
expect(web_form_instance.client_user_id).to eq($client_user_id)
|
265
|
+
expect(web_form_instance.instance_metadata).not_to be_nil
|
266
|
+
else
|
267
|
+
puts "Error: Unexpected response format from get_instance."
|
268
|
+
pending "Unexpected response in get_instance other than WebformInstance"
|
269
|
+
end
|
270
|
+
expect(form_instance).to be_truthy
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe ".ListInstances" do
|
276
|
+
context "given account id and form id" do
|
277
|
+
it "fetch instances" do
|
278
|
+
api_client = create_api_client()
|
279
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
280
|
+
form_instances_object = form_instance_management.list_instances($account_id, $form_id)
|
281
|
+
if form_instances_object.is_a?(DocuSign_WebForms::WebFormInstanceList)
|
282
|
+
form_instances = form_instances_object.items
|
283
|
+
# Ensure that the response from list_forms is correctly structured
|
284
|
+
if form_instances.is_a?(Array) && form_instances.all? { |item| item.is_a?(DocuSign_WebForms::WebFormInstance) }
|
285
|
+
web_form_instances = form_instances
|
286
|
+
web_form_instance = web_form_instances.first
|
287
|
+
expect(web_form_instance.id).to be_truthy
|
288
|
+
expect(web_form_instance.form_id).to eq ($form_id)
|
289
|
+
expect(web_form_instance.account_id).to be_truthy
|
290
|
+
expect(web_form_instance.status).to be_truthy
|
291
|
+
expect(web_form_instance.account_id).to eq($account_id)
|
292
|
+
expect(web_form_instance.instance_metadata).not_to be_nil
|
293
|
+
else
|
294
|
+
puts "Error: Unexpected response format from list_instances."
|
295
|
+
pending "Unexpected item in list form_instances other than WebformInstance"
|
296
|
+
end
|
297
|
+
else
|
298
|
+
puts "Error: Unexpected response format from list_instances_object."
|
299
|
+
pending "Unexpected response in form_instances_object other than WebformInstanceList"
|
300
|
+
end
|
301
|
+
expect(form_instances_object).to be_truthy
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
describe ".RefreshToken" do
|
307
|
+
context "given account id, form id, and instance id" do
|
308
|
+
it "refresh the token" do
|
309
|
+
api_client = create_api_client()
|
310
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
311
|
+
refresh_token = form_instance_management.refresh_token($account_id, $form_id, $instance_id)
|
312
|
+
|
313
|
+
# Ensure that the response from list_forms is correctly structured
|
314
|
+
if refresh_token.is_a?(DocuSign_WebForms::WebFormInstance)
|
315
|
+
web_form_instance = refresh_token
|
316
|
+
expect(web_form_instance.id).to be_truthy
|
317
|
+
expect(web_form_instance.id).to eq ($instance_id)
|
318
|
+
expect(web_form_instance.instance_token).to be_truthy
|
319
|
+
expect(web_form_instance.form_url).to be_truthy
|
320
|
+
expect(web_form_instance.token_expiration_date_time).to be_truthy
|
321
|
+
else
|
322
|
+
puts "Error: Unexpected response format from refresh_token."
|
323
|
+
end
|
324
|
+
expect(refresh_token).to be_truthy
|
325
|
+
end
|
326
|
+
end
|
37
327
|
end
|
328
|
+
|
329
|
+
# Negative testing
|
330
|
+
describe ".CreateInstance" do
|
331
|
+
context "given wrong account id with correct form id, and instance body" do
|
332
|
+
it "should throw API Error" do
|
333
|
+
api_client = create_api_client()
|
334
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
335
|
+
instance_body = DocuSign_WebForms::CreateInstanceRequestBody.new
|
336
|
+
now = DateTime.now
|
337
|
+
client_id = "asif.sajjad-#{now}"
|
338
|
+
instance_body.client_user_id = client_id
|
339
|
+
instance_body.tags = ["general_details"]
|
340
|
+
wrong_account_id = "abc123"
|
341
|
+
|
342
|
+
expect{
|
343
|
+
form_instance = form_instance_management.create_instance(wrong_account_id, $form_id, instance_body)
|
344
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
345
|
+
end
|
346
|
+
end
|
347
|
+
context "given right account id and instance body with wrong form id" do
|
348
|
+
it "should throw API Error" do
|
349
|
+
api_client = create_api_client()
|
350
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
351
|
+
instance_body = DocuSign_WebForms::CreateInstanceRequestBody.new
|
352
|
+
now = DateTime.now
|
353
|
+
client_id = "asif.sajjad-#{now}"
|
354
|
+
instance_body.client_user_id = client_id
|
355
|
+
instance_body.tags = ["general_details"]
|
356
|
+
wrong_form_id = "xyz123"
|
357
|
+
|
358
|
+
expect{
|
359
|
+
form_instance = form_instance_management.create_instance($account_id, wrong_form_id, instance_body)
|
360
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
361
|
+
end
|
362
|
+
end
|
363
|
+
context "given right account id and form id with nil instance body" do
|
364
|
+
it "should throw API Error" do
|
365
|
+
api_client = create_api_client()
|
366
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
367
|
+
instance_body = nil
|
368
|
+
|
369
|
+
expect{
|
370
|
+
form_instance = form_instance_management.create_instance($account_id, $form_id, instance_body)
|
371
|
+
}.to raise_error(ArgumentError)
|
372
|
+
end
|
373
|
+
end
|
374
|
+
context "given nil account id with correct form id and instance body" do
|
375
|
+
it "should throw API Error" do
|
376
|
+
api_client = create_api_client()
|
377
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
378
|
+
instance_body = DocuSign_WebForms::CreateInstanceRequestBody.new
|
379
|
+
now = DateTime.now
|
380
|
+
client_id = "asif.sajjad-#{now}"
|
381
|
+
instance_body.client_user_id = client_id
|
382
|
+
instance_body.tags = ["general_details"]
|
383
|
+
|
384
|
+
expect{
|
385
|
+
form_instance = form_instance_management.create_instance(nil, $form_id, instance_body)
|
386
|
+
}.to raise_error(ArgumentError)
|
387
|
+
end
|
388
|
+
end
|
389
|
+
context "given nil form id with correct account id and instance body" do
|
390
|
+
it "should throw API Error" do
|
391
|
+
api_client = create_api_client()
|
392
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
393
|
+
instance_body = DocuSign_WebForms::CreateInstanceRequestBody.new
|
394
|
+
now = DateTime.now
|
395
|
+
client_id = "asif.sajjad-#{now}"
|
396
|
+
instance_body.client_user_id = client_id
|
397
|
+
instance_body.tags = ["general_details"]
|
398
|
+
|
399
|
+
expect{
|
400
|
+
form_instance = form_instance_management.create_instance($account_id, nil, instance_body)
|
401
|
+
}.to raise_error(ArgumentError)
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
|
407
|
+
describe ".GetInstance" do
|
408
|
+
context "given wrong account id with correct form id, and instance id" do
|
409
|
+
it "should throw API Error" do
|
410
|
+
api_client = create_api_client()
|
411
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
412
|
+
wrong_account_id = "abc123"
|
413
|
+
expect{
|
414
|
+
form_instance = form_instance_management.get_instance(wrong_account_id, $form_id, $instance_id)
|
415
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
context "given wrong form id with correct account id, and instance id" do
|
419
|
+
it "should throw API Error" do
|
420
|
+
api_client = create_api_client()
|
421
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
422
|
+
wrong_form_id = "xyz123"
|
423
|
+
expect{
|
424
|
+
form_instance = form_instance_management.get_instance($account_id, wrong_form_id, $instance_id)
|
425
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
context "given wrong instance id with correct account id, and form id" do
|
429
|
+
it "should throw API Error" do
|
430
|
+
api_client = create_api_client()
|
431
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
432
|
+
wrong_instance_id = "lmn123"
|
433
|
+
expect{
|
434
|
+
form_instance = form_instance_management.get_instance($account_id, $form_id, wrong_instance_id)
|
435
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
436
|
+
end
|
437
|
+
end
|
438
|
+
context "given nil instance id with correct account id, and form id" do
|
439
|
+
it "should throw API Error" do
|
440
|
+
api_client = create_api_client()
|
441
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
442
|
+
expect{
|
443
|
+
form_instance = form_instance_management.get_instance($account_id, $form_id, nil)
|
444
|
+
}.to raise_error(ArgumentError)
|
445
|
+
end
|
446
|
+
end
|
447
|
+
context "given nil account id with correct form id, and instance id" do
|
448
|
+
it "should throw API Error" do
|
449
|
+
api_client = create_api_client()
|
450
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
451
|
+
expect{
|
452
|
+
form_instance = form_instance_management.get_instance(nil, $form_id, $instance_id)
|
453
|
+
}.to raise_error(ArgumentError)
|
454
|
+
end
|
455
|
+
end
|
456
|
+
context "given nil form id with correct account id, and instance id" do
|
457
|
+
it "should throw API Error" do
|
458
|
+
api_client = create_api_client()
|
459
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
460
|
+
expect{
|
461
|
+
form_instance = form_instance_management.get_instance($account_id, nil, $instance_id)
|
462
|
+
}.to raise_error(ArgumentError)
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
end
|
467
|
+
|
468
|
+
|
469
|
+
describe ".ListInstances" do
|
470
|
+
context "given wrong account id and correct form id" do
|
471
|
+
it "should throw API Error" do
|
472
|
+
api_client = create_api_client()
|
473
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
474
|
+
wrong_account_id = "abc123"
|
475
|
+
expect{
|
476
|
+
form_instances = form_instance_management.list_instances(wrong_account_id, $form_id)
|
477
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
478
|
+
end
|
479
|
+
end
|
480
|
+
context "given wrong form id and correct account id" do
|
481
|
+
it "should throw API Error" do
|
482
|
+
api_client = create_api_client()
|
483
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
484
|
+
wrong_form_id = "xyz123"
|
485
|
+
expect{
|
486
|
+
form_instances = form_instance_management.list_instances($account_id, wrong_form_id)
|
487
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
488
|
+
end
|
489
|
+
end
|
490
|
+
context "given nil form id and correct account id" do
|
491
|
+
it "should throw API Error" do
|
492
|
+
api_client = create_api_client()
|
493
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
494
|
+
expect{
|
495
|
+
form_instances = form_instance_management.list_instances($account_id, nil)
|
496
|
+
}.to raise_error(ArgumentError)
|
497
|
+
end
|
498
|
+
end
|
499
|
+
context "given nil account id and correct form id" do
|
500
|
+
it "should throw API Error" do
|
501
|
+
api_client = create_api_client()
|
502
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
503
|
+
expect{
|
504
|
+
form_instances = form_instance_management.list_instances(nil, $form_id)
|
505
|
+
}.to raise_error(ArgumentError)
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
|
511
|
+
describe ".RefreshToken" do
|
512
|
+
context "given wrong account id with correct form id, and instance id" do
|
513
|
+
it "should throw API Error" do
|
514
|
+
api_client = create_api_client()
|
515
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
516
|
+
wrong_account_id = "abc123"
|
517
|
+
expect{
|
518
|
+
refresh_token = form_instance_management.refresh_token(wrong_account_id, $form_id, $instance_id)
|
519
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
520
|
+
end
|
521
|
+
end
|
522
|
+
context "given wrong form id with correct account id, and instance id" do
|
523
|
+
it "should throw API Error" do
|
524
|
+
api_client = create_api_client()
|
525
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
526
|
+
wrong_form_id = "xyz123"
|
527
|
+
expect{
|
528
|
+
refresh_token = form_instance_management.refresh_token($account_id, wrong_form_id, $instance_id)
|
529
|
+
}.to raise_error(DocuSign_WebForms::ApiError)
|
530
|
+
end
|
531
|
+
end
|
532
|
+
context "given nil account id with correct form id, and instance id" do
|
533
|
+
it "should throw API Error" do
|
534
|
+
api_client = create_api_client()
|
535
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
536
|
+
expect{
|
537
|
+
refresh_token = form_instance_management.refresh_token(nil, $form_id, $instance_id)
|
538
|
+
}.to raise_error(ArgumentError)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
context "given nil form id with correct account id, and instance id" do
|
542
|
+
it "should throw API Error" do
|
543
|
+
api_client = create_api_client()
|
544
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
545
|
+
expect{
|
546
|
+
refresh_token = form_instance_management.refresh_token($account_id, nil, $instance_id)
|
547
|
+
}.to raise_error(ArgumentError)
|
548
|
+
end
|
549
|
+
end
|
550
|
+
context "given nil instance id with correct account id, and form id" do
|
551
|
+
it "should throw API Error" do
|
552
|
+
api_client = create_api_client()
|
553
|
+
form_instance_management = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
|
554
|
+
expect{
|
555
|
+
refresh_token = form_instance_management.refresh_token($account_id, $form_id, nil)
|
556
|
+
}.to raise_error(ArgumentError)
|
557
|
+
end
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
end
|
562
|
+
|
38
563
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docusign_webforms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DocuSign
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -270,7 +270,7 @@ dependencies:
|
|
270
270
|
- - ">="
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: 0.2.11
|
273
|
-
description: The
|
273
|
+
description: The Docusign package makes integrating Docusign into your apps and websites
|
274
274
|
a super fast and painless process. The library is open sourced on GitHub, look for
|
275
275
|
the docusign-webforms-ruby-client repository.
|
276
276
|
email:
|
@@ -348,12 +348,14 @@ files:
|
|
348
348
|
- lib/docusign_webforms/models/web_form_state.rb
|
349
349
|
- lib/docusign_webforms/models/web_form_summary.rb
|
350
350
|
- lib/docusign_webforms/models/web_form_summary_list.rb
|
351
|
+
- lib/docusign_webforms/models/web_form_type.rb
|
351
352
|
- lib/docusign_webforms/models/web_form_user_info.rb
|
352
353
|
- lib/docusign_webforms/models/web_form_values.rb
|
353
354
|
- lib/docusign_webforms/models/web_form_version_id.rb
|
354
355
|
- lib/docusign_webforms/version.rb
|
355
356
|
- runLinter.sh
|
356
357
|
- tests/Gemfile
|
358
|
+
- tests/docs/private.pem
|
357
359
|
- tests/spec/unit_tests_using_jwt_spec.rb
|
358
360
|
homepage: https://github.com/docusign/docusign-webforms-ruby-client
|
359
361
|
licenses:
|