Skip to content

Commit ff5c39f

Browse files
Added CI/CD workflow (#105)
* add ci/cd workflow, code style fixes
1 parent 09b4429 commit ff5c39f

38 files changed

+320
-277
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
ruby test/run_tests.rb
34+
env:
35+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
36+
USER_ID: ${{ secrets.USER_ID }}
37+
SIGNER_EMAIL: ${{ secrets.SIGNER_EMAIL }}
38+
SIGNER_NAME: ${{ secrets.SIGNER_NAME }}
39+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
40+

.rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
AllCops:
2+
Exclude:
3+
- '**/db/**/*'
4+
- '**/config/**/*'
5+
- '**/test/**/*'
6+
- '**/bin/**/*'
7+
- '**/*test*'
8+
- '**/vendor/**/*'
9+
10+
Layout/EndOfLine:
11+
Enabled: false
12+
113
Layout/LineLength:
214
Enabled: false
315

@@ -7,6 +19,12 @@ Style/ClassAndModuleChildren:
719
Style/Documentation:
820
Enabled: false
921

22+
Lint/EnsureReturn:
23+
Enabled: false
24+
25+
Style/HashSyntax:
26+
Enabled: false
27+
1028
Style/StringLiterals:
1129
EnforcedStyle: single_quotes
1230

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.2
1+
3.1.2

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ gem 'omniauth-oauth2', '~> 1.7.1'
7777
gem 'omniauth-rails_csrf_protection'
7878

7979
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
80+
gem 'matrix', '~> 0.4.2'
8081
gem 'tzinfo-data', '~> 1.2022.1', '>= 1.2022.1'
8182
gem 'wdm', '>= 0.1.0', platforms: %i[mingw mswin x64_mingw]
82-
83-
gem "matrix", "~> 0.4.2"

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ GEM
142142
jbuilder (2.11.5)
143143
actionview (>= 5.0.0)
144144
activesupport (>= 5.0.0)
145-
json (2.6.2)
145+
json (2.6.3)
146146
jwt (2.5.0)
147147
listen (3.7.1)
148148
rb-fsevent (~> 0.10, >= 0.10.3)

app/controllers/clickwrap/ceg006_embed_clickwrap_controller.rb

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@ class Clickwrap::Ceg006EmbedClickwrapController < EgController
33
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 6, 'Click') }
44

55
def create
6-
begin
7-
args = {
8-
account_id: session[:ds_account_id],
9-
base_path: session[:ds_base_path],
10-
access_token: session[:ds_access_token],
11-
clickwrap_id: params[:clickwrapId],
12-
full_name: params[:fullName],
13-
email: params[:email],
14-
company: params[:company],
15-
title: params[:title],
16-
date: params[:date]
17-
}
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: params[:clickwrapId],
11+
full_name: params[:fullName],
12+
email: params[:email],
13+
company: params[:company],
14+
title: params[:title],
15+
date: params[:date]
16+
}
1817

19-
results = Clickwrap::Eg006EmbedClickwrapService.new(args).worker
18+
results = Clickwrap::Eg006EmbedClickwrapService.new(args).worker
2019

21-
if results == nil
22-
@error_code = '200'
23-
@error_message = 'The email address was already used to agree to this elastic template. Provide a different email address if you want to view the agreement and agree to it.'
24-
render 'ds_common/error'
25-
else
26-
@title = @example['ExampleName']
27-
@message = format_string(@example['ResultsPageText'])
28-
@agreementUrl = results["agreementUrl"]
29-
render 'clickwrap/ceg006_embed_clickwrap/results'
30-
end
31-
rescue DocuSign_Click::ApiError => e
32-
handle_error(e)
20+
if results.nil?
21+
@error_code = '200'
22+
@error_message = 'The email address was already used to agree to this elastic template. Provide a different email address if you want to view the agreement and agree to it.'
23+
render 'ds_common/error'
24+
else
25+
@title = @example['ExampleName']
26+
@message = format_string(@example['ResultsPageText'])
27+
@agreementUrl = results['agreementUrl']
28+
render 'clickwrap/ceg006_embed_clickwrap/results'
3329
end
30+
rescue DocuSign_Click::ApiError => e
31+
handle_error(e)
3432
end
3533

3634
def get

app/controllers/ds_common_controller.rb

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def index
1010
end
1111

1212
def handle_redirects
13-
minimum_buffer_min = 10
1413
if Rails.configuration.quickstart
1514
@manifest = Utils::ManifestUtils.new.get_manifest(Rails.configuration.example_manifest_url)
1615

@@ -19,9 +18,9 @@ def handle_redirects
1918
session[:quickstarted] = true
2019
redirect_to '/auth/docusign'
2120
elsif session[:been_here].nil?
22-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).is_cfr(session[:ds_account_id])
23-
if enableCFR == "enabled"
24-
session[:status_cfr] = "enabled"
21+
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
22+
if enableCFR == 'enabled'
23+
session[:status_cfr] = 'enabled'
2524
@status_cfr = session[:status_cfr]
2625
redirect_to '/eeg041'
2726
else
@@ -31,24 +30,22 @@ def handle_redirects
3130
render_examples
3231
end
3332
elsif session[:ds_access_token].present?
34-
if (!session[:api] || session[:api] == "eSignature")
35-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).is_cfr(session[:ds_account_id])
36-
if enableCFR == "enabled"
37-
session[:status_cfr] = "enabled"
38-
end
33+
if !session[:api] || session[:api] == 'eSignature'
34+
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
35+
session[:status_cfr] = 'enabled' if enableCFR == 'enabled'
3936
end
40-
render_examples
37+
render_examples
4138
else
4239
render_examples
4340
end
4441
end
4542

4643
def render_examples
47-
if(session[:ds_access_token].present? && !session[:status_cfr] && (!session[:api] || session[:api] == "eSignature"))
48-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).is_cfr(session[:ds_account_id])
49-
if enableCFR == "enabled"
50-
@status_cfr = "enabled"
51-
session[:status_cfr] = "enabled"
44+
if session[:ds_access_token].present? && !session[:status_cfr] && (!session[:api] || session[:api] == 'eSignature')
45+
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
46+
if enableCFR == 'enabled'
47+
@status_cfr = 'enabled'
48+
session[:status_cfr] = 'enabled'
5249
end
5350
else
5451
@status_cfr = session[:status_cfr]

app/controllers/e_sign/eeg014_collect_payment_controller.rb

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,35 @@ class ESign::Eeg014CollectPaymentController < EgController
55
before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 14, 'eSignature') }
66

77
def create
8-
begin
9-
envelope_args = {
10-
signer_email: param_gsub(params['signerEmail']),
11-
signer_name: param_gsub(params['signerName']),
12-
cc_email: param_gsub(params['ccEmail']),
13-
cc_name: param_gsub(params['ccName']),
14-
gateway_account_id: Rails.application.config.gateway_account_id,
15-
gateway_name: Rails.application.config.gateway_name,
16-
gateway_display_name: Rails.application.config.gateway_display_name
17-
}
18-
args = {
19-
account_id: session['ds_account_id'],
20-
base_path: session['ds_base_path'],
21-
access_token: session['ds_access_token'],
22-
envelope_args: envelope_args
23-
}
8+
envelope_args = {
9+
signer_email: param_gsub(params['signerEmail']),
10+
signer_name: param_gsub(params['signerName']),
11+
cc_email: param_gsub(params['ccEmail']),
12+
cc_name: param_gsub(params['ccName']),
13+
gateway_account_id: Rails.application.config.gateway_account_id,
14+
gateway_name: Rails.application.config.gateway_name,
15+
gateway_display_name: Rails.application.config.gateway_display_name
16+
}
17+
args = {
18+
account_id: session['ds_account_id'],
19+
base_path: session['ds_base_path'],
20+
access_token: session['ds_access_token'],
21+
envelope_args: envelope_args
22+
}
2423

25-
results = ESign::Eg014CollectPaymentService.new(args).worker
26-
@title = @example['ExampleName']
27-
@message = format_string(@example['ResultsPageText'], results[:envelope_id])
28-
render 'ds_common/example_done'
29-
rescue DocuSign_eSign::ApiError => e
30-
handle_error(e)
31-
end
24+
results = ESign::Eg014CollectPaymentService.new(args).worker
25+
@title = @example['ExampleName']
26+
@message = format_string(@example['ResultsPageText'], results[:envelope_id])
27+
render 'ds_common/example_done'
28+
rescue DocuSign_eSign::ApiError => e
29+
handle_error(e)
3230
end
3331

3432
def get
35-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).is_cfr(session[:ds_account_id])
36-
if enableCFR == "enabled"
37-
session[:status_cfr] = "enabled"
38-
@title = "Not CFR Part 11 compatible"
33+
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
34+
if enableCFR == 'enabled'
35+
session[:status_cfr] = 'enabled'
36+
@title = 'Not CFR Part 11 compatible'
3937
@error_information = @manifest['SupportingTexts']['CFRError']
4038
render 'ds_common/error'
4139
end

app/controllers/e_sign/eeg020_phone_authentication_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ def create
4141
end
4242

4343
def get
44-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).is_cfr(session[:ds_account_id])
45-
if enableCFR == "enabled"
46-
session[:status_cfr] = "enabled"
47-
@title = "Not CFR Part 11 compatible"
44+
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
45+
if enableCFR == 'enabled'
46+
session[:status_cfr] = 'enabled'
47+
@title = 'Not CFR Part 11 compatible'
4848
@error_information = @manifest['SupportingTexts']['CFRError']
4949
render 'ds_common/error'
5050
end

app/controllers/e_sign/eeg032_pauses_signature_workflow_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def create
2727
end
2828

2929
def get
30-
enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).is_cfr(session[:ds_account_id])
31-
if enableCFR == "enabled"
32-
session[:status_cfr] = "enabled"
33-
@title = "Not CFR Part 11 compatible"
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'
3434
@error_information = @manifest['SupportingTexts']['CFRError']
3535
render 'ds_common/error'
3636
end

0 commit comments

Comments
 (0)