Skip to content

Commit 23bb97b

Browse files
pkce auth
2 parents f8d5f2b + 9b51fbf commit 23bb97b

11 files changed

+498
-473
lines changed

.github/workflows/rubyonrails.yml

+47-41
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
1-
# This workflow uses actions that are not certified by GitHub. They are
2-
# provided by a third-party and are governed by separate terms of service,
3-
# privacy policy, and support documentation.
4-
#
5-
# This workflow will install a prebuilt Ruby version, install dependencies, and
6-
# run tests and linters.
7-
name: "Ruby on Rails CI"
8-
on:
9-
push:
10-
branches: [ "master" ]
11-
pull_request:
12-
branches: [ "master" ]
13-
jobs:
14-
build:
15-
runs-on: ubuntu-latest
16-
17-
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v3
20-
21-
- name: Install Ruby and gems
22-
uses: ruby/setup-ruby@v1
23-
with:
24-
bundler-cache: true
25-
ruby-version: 3.1.2
26-
27-
- name: Run linter
28-
run: bundle exec rubocop --parallel
29-
30-
- name: Run tests
31-
run: |
32-
gem install docusign_esign
33-
gem install docusign_click
34-
ruby test/run_tests.rb
35-
env:
36-
CLIENT_ID: ${{ secrets.CLIENT_ID }}
37-
USER_ID: ${{ secrets.USER_ID }}
38-
SIGNER_EMAIL: ${{ secrets.SIGNER_EMAIL }}
39-
SIGNER_NAME: ${{ secrets.SIGNER_NAME }}
40-
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
41-
1+
# This workflow uses actions that are not certified by GitHub. They are
2+
# provided by a third-party and are governed by separate terms of service,
3+
# privacy policy, and support documentation.
4+
#
5+
# This workflow will install a prebuilt Ruby version, install dependencies, and
6+
# run tests and linters.
7+
name: "Ruby on Rails CI"
8+
on:
9+
push:
10+
branches: [ "master" ]
11+
pull_request:
12+
branches: [ "master" ]
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Install Ruby
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
bundler-cache: false
25+
ruby-version: 3.1.2
26+
27+
- name: Update rubygems
28+
run: gem update --system
29+
30+
- name: Install dependencies
31+
run: bundle install
32+
33+
- name: Run linter
34+
run: bundle exec rubocop --parallel
35+
36+
- name: Run tests
37+
run: |
38+
gem install docusign_esign
39+
gem install docusign_click
40+
ruby test/run_tests.rb
41+
env:
42+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
43+
USER_ID: ${{ secrets.USER_ID }}
44+
SIGNER_EMAIL: ${{ secrets.SIGNER_EMAIL }}
45+
SIGNER_NAME: ${{ secrets.SIGNER_NAME }}
46+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
47+
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
class AdminApi::Aeg001CreateUserController < EgController
2-
include ApiCreator
3-
before_action -> { check_auth('Admin') }
4-
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Admin') }
5-
6-
def create
7-
args = {
8-
account_id: session['ds_account_id'],
9-
base_path: session['ds_base_path'],
10-
access_token: session['ds_access_token'],
11-
organization_id: session['organization_id']
12-
}
13-
#ds-snippet-start:Admin1Step5
14-
user_data = {
15-
user_name: param_gsub(params['user_name']),
16-
first_name: param_gsub(params['first_name']),
17-
last_name: param_gsub(params['last_name']),
18-
email: param_gsub(params['email']),
19-
auto_activate_memberships: true,
20-
accounts: [
21-
{
22-
id: args[:account_id],
23-
permission_profile: {
24-
id: request['permission_profile_id']
25-
},
26-
groups: [
27-
{
28-
id: request['group_id']
29-
}
30-
]
31-
}
32-
]
33-
}
34-
#ds-snippet-end:Admin1Step5
35-
36-
begin
37-
results = AdminApi::Eg001CreateUserService.new(args, user_data).worker
38-
39-
@title = @example['ExampleName']
40-
@message = @example['ResultsPageText']
41-
@json = results.to_json.to_json
42-
render 'ds_common/example_done'
43-
rescue DocuSign_Admin::ApiError => e
44-
handle_error(e)
45-
end
46-
end
47-
48-
def get
49-
super
50-
session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
51-
args = {
52-
account_id: session['ds_account_id'],
53-
base_path: session['ds_base_path'],
54-
access_token: session['ds_access_token']
55-
}
56-
57-
#ds-snippet-start:Admin1Step3
58-
accounts_api = create_account_api(args)
59-
@permission_profiles = accounts_api.list_permissions(args[:account_id]).permission_profiles
60-
#ds-snippet-end:Admin1Step3
61-
62-
#ds-snippet-start:Admin1Step4
63-
groups_api = create_group_api(args)
64-
@groups = groups_api.list_groups(args[:account_id]).groups
65-
#ds-snippet-end:Admin1Step4
66-
end
67-
end
1+
class AdminApi::Aeg001CreateUserController < EgController
2+
include ApiCreator
3+
before_action -> { check_auth('Admin') }
4+
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Admin') }
5+
6+
def create
7+
args = {
8+
account_id: session['ds_account_id'],
9+
base_path: session['ds_base_path'],
10+
access_token: session['ds_access_token'],
11+
organization_id: session['organization_id']
12+
}
13+
#ds-snippet-start:Admin1Step5
14+
user_data = {
15+
user_name: param_gsub(params['user_name']),
16+
first_name: param_gsub(params['first_name']),
17+
last_name: param_gsub(params['last_name']),
18+
email: param_gsub(params['email']),
19+
auto_activate_memberships: true,
20+
accounts: [
21+
{
22+
id: args[:account_id],
23+
permission_profile: {
24+
id: param_gsub(params['permission_profile_id'])
25+
},
26+
groups: [
27+
{
28+
id: param_gsub(params['group_id'])
29+
}
30+
]
31+
}
32+
]
33+
}
34+
#ds-snippet-end:Admin1Step5
35+
36+
begin
37+
results = AdminApi::Eg001CreateUserService.new(args, user_data).worker
38+
39+
@title = @example['ExampleName']
40+
@message = @example['ResultsPageText']
41+
@json = results.to_json.to_json
42+
render 'ds_common/example_done'
43+
rescue DocuSign_Admin::ApiError => e
44+
handle_error(e)
45+
end
46+
end
47+
48+
def get
49+
super
50+
session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
51+
args = {
52+
account_id: session['ds_account_id'],
53+
base_path: session['ds_base_path'],
54+
access_token: session['ds_access_token']
55+
}
56+
57+
#ds-snippet-start:Admin1Step3
58+
accounts_api = create_account_api(args)
59+
@permission_profiles = accounts_api.list_permissions(args[:account_id]).permission_profiles
60+
#ds-snippet-end:Admin1Step3
61+
62+
#ds-snippet-start:Admin1Step4
63+
groups_api = create_group_api(args)
64+
@groups = groups_api.list_groups(args[:account_id]).groups
65+
#ds-snippet-end:Admin1Step4
66+
end
67+
end
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
class Clickwrap::Ceg001CreateClickwrapController < EgController
2-
before_action -> { check_auth('Click') }
3-
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Click') }
4-
5-
def create
6-
args = {
7-
account_id: session[:ds_account_id],
8-
base_path: session[:ds_base_path],
9-
access_token: session[:ds_access_token],
10-
doc_pdf: File.join('data', Rails.configuration.doc_terms_pdf),
11-
clickwrap_name: request[:clickwrapName]
12-
}
13-
14-
results = Clickwrap::Eg001CreateClickwrapService.new(args).worker
15-
16-
session[:clickwrap_id] = results.clickwrap_id
17-
session[:clickwrap_name] = results.clickwrap_name
18-
19-
@title = @example['ExampleName']
20-
@message = format_string(@example['ResultsPageText'], results.clickwrap_name)
21-
@json = results.to_json.to_json
22-
render 'ds_common/example_done'
23-
end
24-
end
1+
class Clickwrap::Ceg001CreateClickwrapController < EgController
2+
before_action -> { check_auth('Click') }
3+
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Click') }
4+
5+
def create
6+
args = {
7+
account_id: session[:ds_account_id],
8+
base_path: session[:ds_base_path],
9+
access_token: session[:ds_access_token],
10+
doc_pdf: File.join('data', Rails.configuration.doc_terms_pdf),
11+
clickwrap_name: param_gsub(params[:clickwrapName])
12+
}
13+
14+
results = Clickwrap::Eg001CreateClickwrapService.new(args).worker
15+
16+
session[:clickwrap_id] = results.clickwrap_id
17+
session[:clickwrap_name] = results.clickwrap_name
18+
19+
@title = @example['ExampleName']
20+
@message = format_string(@example['ResultsPageText'], results.clickwrap_name)
21+
@json = results.to_json.to_json
22+
render 'ds_common/example_done'
23+
end
24+
end
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
class Clickwrap::Ceg005ClickwrapResponsesController < EgController
2-
before_action -> { check_auth('Click') }
3-
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 5, 'Click') }
4-
5-
def create
6-
args = {
7-
account_id: session[:ds_account_id],
8-
base_path: session[:ds_base_path],
9-
access_token: session[:ds_access_token],
10-
clickwrap_id: session[:clickwrap_id],
11-
client_user_id: request[:client_user_id]
12-
}
13-
14-
results = Clickwrap::Eg005ClickwrapResponsesService.new(args).worker
15-
16-
@title = @example['ExampleName']
17-
@message = @example['ResultsPageText']
18-
@json = results.to_json.to_json
19-
render 'ds_common/example_done'
20-
end
21-
end
1+
class Clickwrap::Ceg005ClickwrapResponsesController < EgController
2+
before_action -> { check_auth('Click') }
3+
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 5, 'Click') }
4+
5+
def create
6+
args = {
7+
account_id: session[:ds_account_id],
8+
base_path: session[:ds_base_path],
9+
access_token: session[:ds_access_token],
10+
clickwrap_id: session[:clickwrap_id],
11+
client_user_id: param_gsub(params[:client_user_id])
12+
}
13+
14+
results = Clickwrap::Eg005ClickwrapResponsesService.new(args).worker
15+
16+
@title = @example['ExampleName']
17+
@message = @example['ResultsPageText']
18+
@json = results.to_json.to_json
19+
render 'ds_common/example_done'
20+
end
21+
end
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
# frozen_string_literal: true
2-
3-
class ESign::Eeg032PausesSignatureWorkflowController < EgController
4-
before_action -> { check_auth('eSignature') }
5-
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 32, 'eSignature') }
6-
7-
def create
8-
signers = {
9-
signerEmail1: request['signerEmail1'],
10-
signerName1: request['signerName1'],
11-
signerEmail2: request['signerEmail2'],
12-
signerName2: request['signerName2']
13-
}
14-
args = {
15-
accountId: session['ds_account_id'],
16-
basePath: session['ds_base_path'],
17-
accessToken: session['ds_access_token'],
18-
status: 'sent'
19-
}
20-
21-
results = ESign::Eg032PausesSignatureWorkflowService.new(args, signers).worker
22-
23-
@envelop_id = results.to_hash[:envelopeId].to_s
24-
session[:envelope_id] = @envelop_id
25-
26-
render 'e_sign/eeg032_pauses_signature_workflow/return'
27-
end
28-
29-
def get
30-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
31-
if enableCFR == 'enabled'
32-
session[:status_cfr] = 'enabled'
33-
@title = 'Not CFR Part 11 compatible'
34-
@error_information = @manifest['SupportingTexts']['CFRError']
35-
render 'ds_common/error'
36-
end
37-
super
38-
end
39-
end
1+
# frozen_string_literal: true
2+
3+
class ESign::Eeg032PausesSignatureWorkflowController < EgController
4+
before_action -> { check_auth('eSignature') }
5+
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 32, 'eSignature') }
6+
7+
def create
8+
signers = {
9+
signerEmail1: param_gsub(params['signerEmail1']),
10+
signerName1: param_gsub(params['signerName1']),
11+
signerEmail2: param_gsub(params['signerEmail2']),
12+
signerName2: param_gsub(params['signerName2'])
13+
}
14+
args = {
15+
accountId: session['ds_account_id'],
16+
basePath: session['ds_base_path'],
17+
accessToken: session['ds_access_token'],
18+
status: 'sent'
19+
}
20+
21+
results = ESign::Eg032PausesSignatureWorkflowService.new(args, signers).worker
22+
23+
@envelop_id = results.to_hash[:envelopeId].to_s
24+
session[:envelope_id] = @envelop_id
25+
26+
render 'e_sign/eeg032_pauses_signature_workflow/return'
27+
end
28+
29+
def get
30+
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
31+
if enableCFR == 'enabled'
32+
session[:status_cfr] = 'enabled'
33+
@title = 'Not CFR Part 11 compatible'
34+
@error_information = @manifest['SupportingTexts']['CFRError']
35+
render 'ds_common/error'
36+
end
37+
super
38+
end
39+
end

0 commit comments

Comments
 (0)