Skip to content

Commit 06f8db5

Browse files
committed
Updated README and tests comments
1 parent 80e336c commit 06f8db5

File tree

4 files changed

+36
-20
lines changed

4 files changed

+36
-20
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ branches:
44
language: ruby
55
#before_install: openssl aes-256-cbc -K $encrypted_7aa52200b8fc_key -iv $encrypted_7aa52200b8fc_iv -in tests/keys/docusign_private_key.txt.enc -out tests/keys/docusign_private_key.txt -d
66
# command to install dependencies
7-
install: cd tests/spec && bundle install
7+
install: cd tests && bundle install
88
# command to run tests
99
script: bundle exec rspec unit_tests_using_jwt_spec.rb --format documentation

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,45 @@ For details regarding which type of OAuth grant will work best for your DocuSign
3939
For security purposes, DocuSign recommends using the [Authorization Code Grant](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant) flow.
4040

4141
## Running tests:
42+
Pre-conditions:
43+
1. Make sure ruby is installed or install it fallowing the [instructions](https://www.ruby-lang.org/en/documentation/installation/)
44+
2. Login with your DocuSign account on https://appdemo.docusign.com.
45+
3. Open Apps and Keys section in Settings and press Add App and Integration Key button.
46+
4. Enter App name, add secret key, generate RSA key and press Save button, add `https://developers.docusign.com/` to Redirect URIs.
47+
5. Create new template on https://appdemo.docusign.com/templates page and save its ID.
48+
49+
After complete all previous steps for run on the Windows 10 need to do the following:
50+
1. Download curl from https://curl.se/windows/
51+
2. Inside archive find "bin" directory
52+
3. Rename libcurl-x64.def to libcurl.def
53+
4. Rename libcurl-x64.dll to libcurl.dll
54+
5. Copy all files from "bin" directory to C:\Ruby30-x64\bin
4255

4356
To run tests, you need:
4457
1. Create a .env file at the `tests` dir (or rename an existing .env.example file)
4558
2. Enter your data from the developer account
46-
* SECRET=< The secret key of your application > \
59+
* `SECRET` \
4760
settings => Apps and Keys =>
4861
Apps and Integration Keys your app "ACTIONS" => Edit =>
4962
Authentication => Secret Keys
50-
* INTEGRATOR_KEY_JWT=< your Integration Key > \
63+
* `INTEGRATOR_KEY_JWT` \
5164
settings => Apps and Keys => Integration Key of your app
52-
* TEMPLATE_ID=< your template id > \
53-
templates => in MyTemplates list click by choosen template => template id
54-
* USER_ID=< your User ID > \
65+
* `TEMPLATE_ID` \
66+
templates => in MyTemplates list click by chosen template or _create new one_ => template id
67+
* `USER_ID` \
5568
settings => Apps and Keys => User ID
5669

5770
3. Copy private key to `tests/docs/private.pem ` \
5871
Settings => "Apps and Keys"
5972
in Apps and Integration Keys choose your application name => "ACTIONS" Edit => Service Integration => + GENERATE RSA
6073

61-
4. Install dependencies bundle install
74+
4. Run tests: \
75+
`cd tests && bundle install`\
76+
`bundle exec rspec spec/unit_tests_using_jwt_spec.rb --format documentation`
77+
78+
### Important note:
79+
First time you ask for a JWT access token you might need to uncomment lines 19-21 in `tests/spec/unit_tests_using_jwt_spec.rb:19` and grant access to the API
6280

63-
5. Run tests: \
64-
`cd tests`\
65-
`rspec`
6681

6782
## Support
6883
Log issues against this client through GitHub. We also have an [active developer community on Stack Overflow](https://stackoverflow.com/questions/tagged/docusignapi).

tests/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ source 'https://rubygems.org'
22

33
gem 'rspec'
44
gem 'dotenv'
5+
gem 'launchy'
56
gem 'docusign_esign', path: '../'

tests/spec/unit_tests_using_jwt_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require 'docusign_esign'
33
require 'base64'
44
require 'uri'
5+
require 'launchy'
56

67
describe 'DocuSign Ruby Client Tests' do
78
def login
@@ -12,10 +13,13 @@ def login
1213

1314
$api_client = DocuSign_eSign::ApiClient.new(configuration)
1415
$api_client.set_oauth_base_path(DocuSign_eSign::OAuth::DEMO_OAUTH_BASE_PATH)
15-
# $api_client.get_authorization_uri($integrator_key,%w[signature impersonation],$return_url,'code')
16-
# $api_client.request_jwt_application_token($integrator_key,File.read($private_key_filename),$expires_in_seconds,%w[signature impersonation] )
17-
# code = 'code_here'
18-
# $api_client.generate_access_token($integrator_key,$secret,code)
16+
# IMPORTANT NOTE:
17+
# the first time you ask for a JWT access token, you should grant access by making the following call
18+
# visit DocuSign OAuth authorization url in the browser, login, grant access and restart the tests
19+
# url = $api_client.get_authorization_uri($integrator_key,%w[signature organization_read impersonation],$return_url,'code')
20+
# Launchy.open(url)
21+
# abort "Please restart the tests"
22+
# END OF NOTE
1923
end
2024

2125
token_obj = $api_client.request_jwt_user_token(ENV["INTEGRATOR_KEY_JWT"], ENV["USER_ID"], File.read($private_key_filename), $expires_in_seconds)
@@ -348,19 +352,15 @@ def create_envelope_on_document(status, is_embedded_signing)
348352
if !$envelope_id.nil?
349353
api_client = create_api_client()
350354
templates_api = DocuSign_eSign::TemplatesApi.new(api_client)
351-
352-
options = DocuSign_eSign::GetEnvelopeOptions.new
353-
$template_id = ENV["TEMPLATE_ID"]
354-
355355
options = DocuSign_eSign::GetOptions.new
356356
options.include = "tabs"
357357

358-
template_summary = templates_api.get($account_id, $template_id, options)
358+
template_summary = templates_api.get($account_id, ENV["TEMPLATE_ID"], options)
359359
end
360360

361361
expect(template_summary).to be_truthy
362362
if !template_summary.nil?
363-
expect(template_summary.template_id).to eq($template_id)
363+
expect(template_summary.template_id).to eq(ENV["TEMPLATE_ID"])
364364
end
365365
end
366366
end

0 commit comments

Comments
 (0)