docusign_esign 2.0.0 → 2.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,5 +10,5 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
10
10
  =end
11
11
 
12
12
  module DocuSign_eSign
13
- VERSION = "2.0.0"
13
+ VERSION = "2.1.0.rc1"
14
14
  end
data/tests/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- docusign_esign (2.0.0)
5
- json (~> 1.8, >= 1.8.3)
4
+ docusign_esign (2.1.0)
5
+ json (~> 2.1, >= 2.1.0)
6
6
  jwt (~> 1.0, >= 1.5.2)
7
7
  typhoeus (~> 1.0, >= 1.0.1)
8
8
 
@@ -13,21 +13,21 @@ GEM
13
13
  ethon (0.12.0)
14
14
  ffi (>= 1.3.0)
15
15
  ffi (1.11.1)
16
- json (1.8.6)
16
+ json (2.2.0)
17
17
  jwt (1.5.6)
18
18
  rspec (3.8.0)
19
19
  rspec-core (~> 3.8.0)
20
20
  rspec-expectations (~> 3.8.0)
21
21
  rspec-mocks (~> 3.8.0)
22
- rspec-core (3.8.0)
22
+ rspec-core (3.8.2)
23
23
  rspec-support (~> 3.8.0)
24
- rspec-expectations (3.8.3)
24
+ rspec-expectations (3.8.4)
25
25
  diff-lcs (>= 1.2.0, < 2.0)
26
26
  rspec-support (~> 3.8.0)
27
- rspec-mocks (3.8.0)
27
+ rspec-mocks (3.8.1)
28
28
  diff-lcs (>= 1.2.0, < 2.0)
29
29
  rspec-support (~> 3.8.0)
30
- rspec-support (3.8.0)
30
+ rspec-support (3.8.2)
31
31
  typhoeus (1.3.1)
32
32
  ethon (>= 0.9.0)
33
33
 
@@ -39,4 +39,4 @@ DEPENDENCIES
39
39
  rspec
40
40
 
41
41
  BUNDLED WITH
42
- 2.0.1
42
+ 2.0.2
@@ -17,7 +17,12 @@ describe 'DocuSign Ruby Client Tests' do
17
17
  # $api_client.generate_access_token($integrator_key,$secret,code)
18
18
  end
19
19
 
20
- token_obj = $api_client.request_jwt_user_token($integrator_key,$user_id, File.read($private_key_filename),$expires_in_seconds)
20
+ decode_base64_content = Base64.decode64(ENV["PRIVATE_KEY"])
21
+ File.open($private_key_filename, "wb") do |f|
22
+ f.write(decode_base64_content)
23
+ end
24
+
25
+ token_obj = $api_client.request_jwt_user_token(ENV["INTEGRATOR_KEY_JWT"],ENV["USER_ID"], File.read($private_key_filename),$expires_in_seconds)
21
26
 
22
27
  user_info = $api_client.get_user_info(token_obj.access_token)
23
28
 
@@ -55,13 +60,13 @@ describe 'DocuSign Ruby Client Tests' do
55
60
  def create_envelope_on_document(status, is_embedded_signing)
56
61
  if(!$account_id.nil?)
57
62
  # STEP 2: Create envelope definition
58
- # Add a document to the envelope
63
+ # Add a document to the envelope
59
64
  document_path = "../docs/Test.pdf"
60
65
  document_name = "Test.docx"
61
66
  document = DocuSign_eSign::Document.new
62
- document.document_base64 = Base64.encode64(File.open(document_path).read)
63
- document.name = document_name
64
- document.document_id = '1'
67
+ document.document_base64 = Base64.encode64(File.open(document_path).read)
68
+ document.name = document_name
69
+ document.document_id = '1'
65
70
 
66
71
  # Create a |SignHere| tab somewhere on the document for the recipient to sign
67
72
  signHere = DocuSign_eSign::SignHere.new
@@ -75,7 +80,7 @@ describe 'DocuSign Ruby Client Tests' do
75
80
  tabs.sign_here_tabs = Array(signHere)
76
81
 
77
82
  signer = DocuSign_eSign::Signer.new
78
- signer.email = $recipient_email
83
+ signer.email = ENV["RECIPIENT_EMAIL"]
79
84
  signer.name = $recipient_name
80
85
  signer.recipient_id = "1"
81
86
 
@@ -110,14 +115,10 @@ describe 'DocuSign Ruby Client Tests' do
110
115
  # run before each test
111
116
  $host = "https://demo.docusign.net/restapi"
112
117
 
113
- $integrator_key = 'ae30ea4e-3959-4d1c-b867-fcb57d2dc4df'
114
- $user_id = 'fcc5726c-cd73-4844-b580-40bbbe6ca126'
115
118
  $expires_in_seconds = 3600 #1 hour
116
119
  $auth_server = 'account-d.docusign.com'
117
120
  $private_key_filename = '../docs/private.pem'
118
- $secret = '3b61ffcf-8f76-4cf8-b541-d49f7d82cb55'
119
-
120
- $recipient_email = "node_sdk@mailinator.com"
121
+
121
122
  $recipient_name = "Ruby SDK"
122
123
 
123
124
  # Required for embedded signing url
@@ -226,7 +227,7 @@ describe 'DocuSign Ruby Client Tests' do
226
227
  recipient_view_request.client_user_id = $client_user_id
227
228
  recipient_view_request.authentication_method = $authentication_method
228
229
  recipient_view_request.user_name = $recipient_name
229
- recipient_view_request.email = $recipient_email
230
+ recipient_view_request.email = ENV["RECIPIENT_EMAIL"]
230
231
 
231
232
  view_url = envelopes_api.create_recipient_view($account_id, $envelope_id, recipient_view_request)
232
233
  end
@@ -267,23 +268,83 @@ describe 'DocuSign Ruby Client Tests' do
267
268
  envelope_summary = nil
268
269
 
269
270
  if !$envelope_id.nil?
270
- api_client = create_api_client()
271
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
272
-
273
- options = DocuSign_eSign::GetEnvelopeOptions.new
271
+ api_client = create_api_client()
272
+ envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
273
+
274
+ options = DocuSign_eSign::GetEnvelopeOptions.new
274
275
 
275
- envelope_summary = envelopes_api.get_envelope($account_id, $envelope_id, options)
276
- end
276
+ envelope_summary = envelopes_api.get_envelope($account_id, $envelope_id, options)
277
+ end
277
278
 
278
- expect(envelope_summary).to be_truthy
279
- if !envelope_summary.nil?
280
- expect(envelope_summary.envelope_id).to eq($envelope_id)
281
- end
279
+ expect(envelope_summary).to be_truthy
280
+ if !envelope_summary.nil?
281
+ expect(envelope_summary.envelope_id).to eq($envelope_id)
282
+ end
283
+ end
284
+ end
285
+
286
+ context 'get template information' do
287
+ it 'successfully returns template' do
288
+ template_summary = nil
289
+
290
+ if !$envelope_id.nil?
291
+ api_client = create_api_client()
292
+ templates_api = DocuSign_eSign::TemplatesApi.new(api_client)
293
+
294
+ options = DocuSign_eSign::GetEnvelopeOptions.new
295
+ $template_id = ENV["TEMPLATE_ID"]
296
+
297
+ template_summary = templates_api.get($account_id, $template_id)
298
+ end
299
+
300
+ expect(template_summary).to be_truthy
301
+ if !template_summary.nil? && !template_summary.envelope_template_definition.nil?
302
+ expect(template_summary.envelope_template_definition.template_id).to eq($template_id)
303
+ end
282
304
  end
283
305
  end
284
306
  end
285
307
 
286
308
  describe '.list' do
309
+ context 'list envelopes' do
310
+ it 'successfully list envelope' do
311
+ recipients = nil
312
+
313
+ envelope_ids = ""
314
+ count1 = 0
315
+ count2 = 0
316
+
317
+ if !$envelope_id.nil?
318
+ api_client = create_api_client()
319
+ envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
320
+
321
+ options = DocuSign_eSign::ListStatusChangesOptions.new
322
+ options.count = "10"
323
+ options.from_date = (Date.today-30).strftime("%Y-%m-%d")
324
+
325
+ envelopes_information = envelopes_api.list_status_changes($account_id, options)
326
+ expect(envelopes_information).to be_truthy
327
+ if !envelopes_information.nil?
328
+ expect(envelopes_information.envelopes.length).to be > 0
329
+ count1 = envelopes_information.envelopes.length
330
+ envelope_ids = envelopes_information.envelopes.map { |f| f.envelope_id }.join ','
331
+ end
332
+
333
+ options = DocuSign_eSign::ListStatusChangesOptions.new
334
+ options.envelope_ids = envelope_ids
335
+
336
+ envelopes_information = envelopes_api.list_status_changes($account_id, options)
337
+ end
338
+
339
+ expect(envelopes_information).to be_truthy
340
+ if !envelopes_information.nil?
341
+ expect(envelopes_information.envelopes.length).to be > 0
342
+ count2 = envelopes_information.envelopes.length
343
+ expect(count1 == count2)
344
+ end
345
+ end
346
+ end
347
+
287
348
  context 'list recipients' do
288
349
  it 'successfully list envelope recipients' do
289
350
  recipients = nil
@@ -355,8 +416,8 @@ describe 'DocuSign Ruby Client Tests' do
355
416
  end
356
417
  end
357
418
  end
419
+ end
358
420
  end
359
- end
360
421
  end
361
422
  end
362
423
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docusign_esign
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.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: 2019-06-08 00:00:00.000000000 Z
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -56,80 +56,80 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.8'
59
+ version: '2.1'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.8.3
62
+ version: 2.1.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.8'
69
+ version: '2.1'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.8.3
72
+ version: 2.1.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rspec-mocks
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: 3.8.0
80
77
  - - "~>"
81
78
  - !ruby/object:Gem::Version
82
79
  version: '3.8'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.8.0
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 3.8.0
90
87
  - - "~>"
91
88
  - !ruby/object:Gem::Version
92
89
  version: '3.8'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 3.8.0
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rspec-expectations
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: 3.8.0
100
97
  - - "~>"
101
98
  - !ruby/object:Gem::Version
102
99
  version: '3.8'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 3.8.0
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: 3.8.0
110
107
  - - "~>"
111
108
  - !ruby/object:Gem::Version
112
109
  version: '3.8'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.8.0
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: 3.4.0
120
117
  - - "~>"
121
118
  - !ruby/object:Gem::Version
122
119
  version: '3.4'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 3.4.0
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- version: 3.4.0
130
127
  - - "~>"
131
128
  - !ruby/object:Gem::Version
132
129
  version: '3.4'
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 3.4.0
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: vcr
135
135
  requirement: !ruby/object:Gem::Requirement
@@ -259,16 +259,16 @@ executables: []
259
259
  extensions: []
260
260
  extra_rdoc_files: []
261
261
  files:
262
+ - CHANGELOG.md
262
263
  - Gemfile
263
264
  - Gemfile.lock
264
265
  - LICENSE
265
266
  - README.md
266
267
  - Rakefile
268
+ - docusign_esign-2.1.0.gem
267
269
  - docusign_esign.gemspec
268
270
  - git_push.sh
269
- - lib/.DS_Store
270
271
  - lib/docusign_esign.rb
271
- - lib/docusign_esign/.DS_Store
272
272
  - lib/docusign_esign/api/accounts_api.rb
273
273
  - lib/docusign_esign/api/authentication_api.rb
274
274
  - lib/docusign_esign/api/billing_api.rb
@@ -288,7 +288,6 @@ files:
288
288
  - lib/docusign_esign/api/trust_service_providers_api.rb
289
289
  - lib/docusign_esign/api/users_api.rb
290
290
  - lib/docusign_esign/api/workspaces_api.rb
291
- - lib/docusign_esign/client/.DS_Store
292
291
  - lib/docusign_esign/client/api_client.rb
293
292
  - lib/docusign_esign/client/api_error.rb
294
293
  - lib/docusign_esign/client/auth/oauth.rb
@@ -550,6 +549,7 @@ files:
550
549
  - lib/docusign_esign/models/recipient_email_notification.rb
551
550
  - lib/docusign_esign/models/recipient_event.rb
552
551
  - lib/docusign_esign/models/recipient_form_data.rb
552
+ - lib/docusign_esign/models/recipient_identity_verification.rb
553
553
  - lib/docusign_esign/models/recipient_names_response.rb
554
554
  - lib/docusign_esign/models/recipient_phone_authentication.rb
555
555
  - lib/docusign_esign/models/recipient_saml_authentication.rb
@@ -660,8 +660,7 @@ files:
660
660
  - tests/Gemfile
661
661
  - tests/Gemfile.lock
662
662
  - tests/docs/Test.pdf
663
- - tests/docs/private.pem
664
- - tests/spec/unit_tests_spec.rb
663
+ - tests/spec/.DS_Store
665
664
  - tests/spec/unit_tests_using_jwt_spec.rb
666
665
  homepage: https://github.com/docusign/docusign-ruby-client
667
666
  licenses:
@@ -678,11 +677,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
678
677
  version: '1.9'
679
678
  required_rubygems_version: !ruby/object:Gem::Requirement
680
679
  requirements:
681
- - - ">="
680
+ - - ">"
682
681
  - !ruby/object:Gem::Version
683
- version: '0'
682
+ version: 1.3.1
684
683
  requirements: []
685
- rubygems_version: 3.0.3
684
+ rubyforge_project:
685
+ rubygems_version: 2.5.2.3
686
686
  signing_key:
687
687
  specification_version: 4
688
688
  summary: DocuSign REST API Ruby Gem
data/lib/.DS_Store DELETED
Binary file
Binary file
@@ -1,27 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIIEogIBAAKCAQEAh0VLAZe6m36tbthAom/IRzxvm/i66mEpow9AsrFP3EAybtVw
3
- 2s13RJ1f0ZJA4sB7SbOtRymIxLlVUWkZLW4NqtECrObqOuke+G2ROWfOhcAyMuiB
4
- lW44mvl8Gil+n6Lwif2+OtUQ88iwPuE6I7jKnBV82lNGDx3H1hqHl7wpQZRyRPCd
5
- zPCrh6TRHj1D40mvrUwqAptj5m71QKA9tWVAQQ1DGKJZVZI4mdz3+I1XCinF8zrx
6
- IUJyEtaJfCHiS086XF3Sw7DkU2o/QIIYbpxlf9Zdjr1QT6/ow7pwJbX2/GSQW2mV
7
- GSY0KSiPFVjbpjKBpVpd4vgnQqn10BzLvLNySwIDAQABAoIBAA2opAm9oeSYlneW
8
- U3RzeBQlWJm1tF39QKCL5jsE52z0eIMzfylAzPW7NFUrgOzEhc5r26fPXFWM5z4I
9
- sDejoLKqVyxRRr57EpsAKUVUI4ji3s7AJnGJxyJy5aKYpQYGhGZSnlY/dG5BSfaX
10
- dHDt9FttWgWLmgvltGt8k0txfvL1nYEQxXxE5gMKNKKoBXE8QF05BmpajApd+hhL
11
- rGLicYpqsrliXr818HvFEKS8ODYfN856osLsvBJDANEW9+OiRQ9QQs5qdStrA5IX
12
- 35DktfSs5Tvr8ZkJksQyfIO4WmEVSJIkm00BL1oSWHAM0Zqv23u6H7HtmCBnvbpw
13
- DY33t+ECgYEA4r9rjODMNhuGgrktDsBE+IQcvoWiYiV00OipZzx0l1q3HmRB51Jo
14
- C/pQ+X6YHT3qZN263VksmlbzpvRQTeL97narhpW8ZdW/L0e6g9sOBchewItftfAJ
15
- CdXmzaaPHEzVu56YGwtS1QC6IVdomxgmXNNuUYgyHt6KgDpVuHBi3usCgYEAmLi/
16
- cLSnIHPT42WFf2IgQWxT7vcBxe4pL0zjzC4NSi8m//g/F/MpQfgsSjreEx5hE6+4
17
- tAh6J2MZwcejbdCgV6eES84fEGDDYGT3GV9qwCTp6Z374hjP+0ZeGcFnzZLsrPPc
18
- T5K/uaIH7n2dPzNe3aLCslnpStVIUz60mnusoiECgYAUk2A0EXYWdtr248zV6NaZ
19
- YoulMkUw+Msn5eTxbEf8MAwr4tckIZM1ewp8CWPOS38IliJN0bi9bKSBguwClVWL
20
- nRMljFLjPskxhiXDr04PckY+3KbbwKNhVBq0kKet3r8KXnLZCWcD0yQQwHjKkh9x
21
- DvKUzXIW4QTaa/C5YuFl7wKBgHDF68fD/q1+GncOXnfj88GbxpbtGwgXh53//y6k
22
- yvd+viPCIoUC7/Jg2gOuWJJxmmm5FoEKyXkQOtLXIp1SszRG5PA9Mr8bVOp3Y+f+
23
- h4t/NqNmH7ujauE34wDNymMJHW/RW1v/F0hyl7zKUTV8L48mQvMEZbr2p8OgyChT
24
- LvVBAoGAFPjp50Q3vaZ1aghIjCfSoi0eU5tVbMCAXpwrjLkCGkw8r6U1ILQyMvqw
25
- E57cqoj2hsZ3P7qgQvZox1L7THnAKNYIdM/tj444QmsYudC5wp5hZBEzmmwbIeq8
26
- 3h4V9F7T/1PamwfRhZC3t4wf327HEMu0pZlwARWpuxh4eaXumYM=
27
- -----END RSA PRIVATE KEY-----
@@ -1,358 +0,0 @@
1
- require 'docusign_esign'
2
- require 'base64'
3
- require 'uri'
4
-
5
- describe 'DocuSign Ruby Client Tests' do
6
- def login(username, password, integrator_key)
7
- begin
8
- configuration = DocuSign_eSign::Configuration.new
9
- configuration.host = "https://demo.docusign.net/restapi"
10
-
11
- api_client = DocuSign_eSign::ApiClient.new(configuration)
12
- api_client.default_headers.store("X-DocuSign-Authentication", $auth_header)
13
-
14
- authentication_api = DocuSign_eSign::AuthenticationApi.new(api_client)
15
-
16
- login_options = DocuSign_eSign::LoginOptions.new
17
-
18
- login_information = authentication_api.login(login_options)
19
-
20
- if !login_information.nil?
21
- login_information.login_accounts.each do |login_account|
22
- if login_account.is_default == "true"
23
- $base_url = login_account.base_url
24
- $account_id = login_account.account_id
25
-
26
- return login_account
27
- end
28
- end
29
- end
30
- rescue => e
31
- puts "Error during processing: #{$!}"
32
- # puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
33
- end
34
-
35
- return nil
36
- end
37
-
38
- def create_api_client
39
- api_client = nil
40
-
41
- if !$base_url.nil?
42
- configuration = DocuSign_eSign::Configuration.new
43
-
44
- # IMPORTANT: Use the base url from the login account to instantiant the api_client
45
- base_uri = URI.parse($base_url)
46
- configuration.host = "%s://%s/restapi" % [base_uri.scheme, base_uri.host]
47
-
48
- api_client = DocuSign_eSign::ApiClient.new(configuration)
49
- api_client.default_headers.store("X-DocuSign-Authentication", $auth_header)
50
- end
51
-
52
- return api_client
53
- end
54
-
55
- def create_envelope_on_document(status, is_embedded_signing)
56
- if(!$account_id.nil?)
57
- # STEP 2: Create envelope definition
58
- # Add a document to the envelope
59
- document_path = "../docs/Test.pdf"
60
- document_name = "Test.docx"
61
- document = DocuSign_eSign::Document.new
62
- document.document_base64 = Base64.encode64(File.open(document_path).read)
63
- document.name = document_name
64
- document.document_id = '1'
65
-
66
- # Create a |SignHere| tab somewhere on the document for the recipient to sign
67
- signHere = DocuSign_eSign::SignHere.new
68
- signHere.x_position = "100"
69
- signHere.y_position = "100"
70
- signHere.document_id = "1"
71
- signHere.page_number = "1"
72
- signHere.recipient_id = "1"
73
-
74
- tabs = DocuSign_eSign::Tabs.new
75
- tabs.sign_here_tabs = Array(signHere)
76
-
77
- signer = DocuSign_eSign::Signer.new
78
- signer.email = $recipient_email
79
- signer.name = $recipient_name
80
- signer.recipient_id = "1"
81
-
82
- if(is_embedded_signing)
83
- signer.client_user_id = $client_user_id
84
- end
85
-
86
- signer.tabs = tabs
87
-
88
- # Add a recipient to sign the document
89
- recipients = DocuSign_eSign::Recipients.new
90
- recipients.signers = Array(signer)
91
-
92
- envelop_definition = DocuSign_eSign::EnvelopeDefinition.new
93
- envelop_definition.email_subject = "[DocuSign Ruby SDK] - Please sign this doc"
94
-
95
- # set envelope status to "sent" to immediately send the signature request
96
- envelop_definition.status = status.nil? ? 'sent' : status
97
- envelop_definition.recipients = recipients
98
- envelop_definition.documents = Array(document)
99
-
100
- options = DocuSign_eSign::CreateEnvelopeOptions.new
101
-
102
- # STEP 3: Create envelope
103
- api_client = create_api_client()
104
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
105
- return envelopes_api.create_envelope($account_id, envelop_definition, options)
106
- end
107
- end
108
-
109
- before(:all) do
110
- # run before each test
111
- $username = 'node_sdk@mailinator.com'
112
- $password = 'qweqweasdasd'
113
- $integrator_key = 'ae30ea4e-3959-4d1c-b867-fcb57d2dc4df'
114
-
115
- $auth_header = '{"Username": "%s", "Password": "%s", "IntegratorKey": "%s"}' %[$username, $password, $integrator_key]
116
-
117
- $recipient_email = "node_sdk@mailinator.com"
118
- $recipient_name = "Ruby SDK"
119
-
120
- # Required for embedded signing url
121
- $client_user_id = '1234'
122
- $return_url = 'https://developers.docusign.com/'
123
- $authentication_method = 'email'
124
-
125
- $template_id = ''
126
- $envelope_id = nil
127
-
128
- $base_url = nil
129
- $account_id = nil
130
- end
131
-
132
- after do
133
- # run after each test
134
- end
135
-
136
- describe DocuSign_eSign::AuthenticationApi do
137
- describe '.login' do
138
- context 'given correct credentials' do
139
- it 'return LoginAccount' do
140
- login_account = login($username, $password, $integrator_key)
141
-
142
- if !login_account.nil?
143
- $base_url = login_account.base_url
144
- $account_id = login_account.account_id
145
- end
146
-
147
- expect($account_id).to be_truthy
148
- expect($base_url).to be_truthy
149
- end
150
- end
151
- end
152
- end
153
-
154
- describe DocuSign_eSign::EnvelopesApi do
155
- describe '.create' do
156
- context 'request signature on a document' do
157
- it 'successfully create an envelope' do
158
-
159
- # STEP 1: Login and get the account_id & base_url
160
- login($username, $password, $integrator_key)
161
-
162
- envelope_summary = create_envelope_on_document('created', true)
163
-
164
- expect(envelope_summary).to be_truthy
165
-
166
- if !envelope_summary.nil?
167
- $envelope_id = envelope_summary.envelope_id
168
- expect($envelope_id).to be_truthy
169
- end
170
- end
171
- end
172
-
173
- context 'request signature using a template' do
174
- it 'successfully send an envelope' do
175
- # TODO
176
- end
177
- end
178
-
179
- context 'sender view' do
180
- it 'successfully returns sender view url' do
181
- view_url = nil
182
-
183
- if !$envelope_id.nil?
184
- api_client = create_api_client()
185
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
186
-
187
- return_url_request = DocuSign_eSign::ReturnUrlRequest.new
188
- return_url_request.return_url = $return_url
189
-
190
- view_url = envelopes_api.create_sender_view($account_id, $envelope_id, return_url_request)
191
- end
192
-
193
- expect(view_url).to be_truthy
194
- if !view_url.nil?
195
- expect(view_url.url).to be_truthy
196
- end
197
- end
198
- end
199
-
200
- context 'recipient view' do
201
- it 'successfully returns embedded signing view url' do
202
- view_url = nil
203
-
204
- if !$envelope_id.nil?
205
- api_client = create_api_client()
206
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
207
-
208
- envelope = DocuSign_eSign::Envelope.new
209
- envelope.status = 'sent'
210
-
211
- options = DocuSign_eSign::UpdateOptions.new
212
-
213
- envelope_update_summary = envelopes_api.update($account_id, $envelope_id, envelope, options)
214
-
215
- expect(envelope_update_summary).to be_truthy
216
- if(!envelope_update_summary.nil?)
217
- expect(envelope_update_summary.envelope_id).to be_truthy
218
- end
219
-
220
- recipient_view_request = DocuSign_eSign::RecipientViewRequest.new
221
- recipient_view_request.return_url = $return_url
222
- recipient_view_request.client_user_id = $client_user_id
223
- recipient_view_request.authentication_method = $authentication_method
224
- recipient_view_request.user_name = $recipient_name
225
- recipient_view_request.email = $recipient_email
226
-
227
- view_url = envelopes_api.create_recipient_view($account_id, $envelope_id, recipient_view_request)
228
- end
229
-
230
- expect(view_url).to be_truthy
231
- if !view_url.nil?
232
- expect(view_url.url).to be_truthy
233
- end
234
- end
235
- end
236
-
237
- context 'embedded console view' do
238
- it 'successfully returns embedded console view url' do
239
- view_url = nil
240
-
241
- if !$envelope_id.nil?
242
- api_client = create_api_client()
243
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
244
-
245
- console_view_request = DocuSign_eSign::ConsoleViewRequest.new
246
- console_view_request.envelope_id = $envelope_id
247
- console_view_request.return_url = $return_url
248
-
249
- view_url = envelopes_api.create_console_view($account_id, console_view_request)
250
- end
251
-
252
- expect(view_url).to be_truthy
253
- if !view_url.nil?
254
- expect(view_url.url).to be_truthy
255
- end
256
- end
257
- end
258
- end
259
-
260
- describe '.get' do
261
- context 'get envelope information' do
262
- it 'successfully returns envelope summary' do
263
- envelope_summary = nil
264
-
265
- if !$envelope_id.nil?
266
- api_client = create_api_client()
267
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
268
-
269
- options = DocuSign_eSign::GetEnvelopeOptions.new
270
-
271
- envelope_summary = envelopes_api.get_envelope($account_id, $envelope_id, options)
272
- end
273
-
274
- expect(envelope_summary).to be_truthy
275
- if !envelope_summary.nil?
276
- expect(envelope_summary.envelope_id).to eq($envelope_id)
277
- end
278
- end
279
- end
280
- end
281
-
282
- describe '.list' do
283
- context 'list recipients' do
284
- it 'successfully list envelope recipients' do
285
- recipients = nil
286
-
287
- if !$envelope_id.nil?
288
- api_client = create_api_client()
289
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
290
-
291
- options = DocuSign_eSign::ListRecipientsOptions.new
292
-
293
- recipients = envelopes_api.list_recipients($account_id, $envelope_id, options)
294
- end
295
-
296
- expect(recipients).to be_truthy
297
- if !recipients.nil?
298
- expect(recipients.recipient_count.to_i).to be > 0
299
- end
300
- end
301
- end
302
-
303
- context 'list status changes' do
304
- it 'successfully lists envelope status changes' do
305
- envelopes_information = nil
306
-
307
- if !$envelope_id.nil?
308
- api_client = create_api_client()
309
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
310
-
311
- options = DocuSign_eSign::ListStatusChangesOptions.new
312
- options.from_date = Time.now.strftime("%Y-%m-%d")
313
-
314
- envelopes_information = envelopes_api.list_status_changes($account_id, options)
315
- end
316
-
317
- expect(envelopes_information).to be_truthy
318
- if !envelopes_information.nil?
319
- expect(envelopes_information.total_set_size.to_i).to be > 0
320
- end
321
- end
322
- end
323
-
324
- context 'list documents and download' do
325
- it 'successfully lists and download envelope documents' do
326
- envelope_documents_result = nil
327
-
328
- if !$envelope_id.nil?
329
- api_client = create_api_client()
330
- envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
331
-
332
- envelope_documents_result = envelopes_api.list_documents($account_id, $envelope_id)
333
- end
334
-
335
- expect(envelope_documents_result).to be_truthy
336
- if !envelope_documents_result.nil?
337
- expect(envelope_documents_result.envelope_id).to eq($envelope_id)
338
- expect(envelope_documents_result.envelope_documents).to be_truthy
339
-
340
- if !envelope_documents_result.envelope_documents.nil?
341
- expect(envelope_documents_result.envelope_documents.count).to be > 0
342
-
343
-
344
- if envelope_documents_result.envelope_documents.count > 0
345
- options = DocuSign_eSign::GetDocumentOptions.new
346
-
347
- envelope_documents_result.envelope_documents.each do |envelope_document|
348
- document = envelopes_api.get_document($account_id, envelope_document.document_id, $envelope_id, options)
349
- expect(document).to be_truthy
350
- end
351
- end
352
- end
353
- end
354
- end
355
- end
356
- end
357
- end
358
- end