finapps 5.0.35 → 5.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/release-drafter.yml +49 -0
- data/.github/workflows/main.yaml +4 -3
- data/.github/workflows/release-drafter.yml +15 -0
- data/.github/workflows/release.yml +54 -0
- data/.github/workflows/verify-pr-labeled.yml +14 -0
- data/.rubocop.yml +5 -12
- data/.rubocop_todo.yml +1 -1
- data/RELEASES.md +9 -0
- data/finapps.gemspec +0 -1
- data/lib/finapps.rb +2 -0
- data/lib/finapps/rest/client.rb +2 -0
- data/lib/finapps/rest/documents_orders.rb +1 -1
- data/lib/finapps/rest/documents_upload_types.rb +11 -0
- data/lib/finapps/rest/documents_uploads.rb +31 -0
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/documents_upload_types_spec.rb +21 -0
- data/spec/rest/documents_uploads_spec.rb +157 -0
- data/spec/rest/signed_documents_downloads_spec.rb +4 -7
- data/spec/rest/verix/verix_documents_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/support/documents_uploads_routes.rb +39 -0
- data/spec/support/fake_api.rb +451 -443
- data/spec/support/fixtures/upload_types.json +9 -0
- metadata +74 -82
- data/lib/tasks/releaser.rake +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ef2ce4cd675c162a8b7d7c932fd85235fd4f30f5553fd2f829f89768d35451
|
4
|
+
data.tar.gz: a3bc58dc9f244eb8300a2e49fd9e24a429bcaf3211fb4468686e3d8db14c5328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a250e599314beab25f3bbd0d2d2781f9af75ff59ef28bc130a748456ae3bbef9516b70c51ee91c465bbc96b55d69f74f190c9a5b09ab3d703f6efb23d43a378
|
7
|
+
data.tar.gz: 759cbe18313cbaa105d9ea7439e962215a3c5be7a773c2662ee63dddb315adafcd8a52b3508eb05982dedf986642a9374972aad52638e875479cfc269b9171ba
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name-template: 'version $RESOLVED_VERSION'
|
2
|
+
tag-template: 'v$RESOLVED_VERSION'
|
3
|
+
categories:
|
4
|
+
- title: 'Added'
|
5
|
+
labels: 'enhancement'
|
6
|
+
- title: 'Changed'
|
7
|
+
labels: 'change'
|
8
|
+
- title: 'Deprecated'
|
9
|
+
labels: 'deprecated'
|
10
|
+
- title: 'Removed'
|
11
|
+
labels: 'removed'
|
12
|
+
- title: 'Fixed'
|
13
|
+
labels: 'bug'
|
14
|
+
- title: 'Security'
|
15
|
+
label: 'dependencies'
|
16
|
+
- title: 'Documentation updates'
|
17
|
+
label: 'documentation'
|
18
|
+
- title: 'Maintenance'
|
19
|
+
labels: 'internal'
|
20
|
+
|
21
|
+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
22
|
+
|
23
|
+
version-resolver:
|
24
|
+
major:
|
25
|
+
labels:
|
26
|
+
- 'major'
|
27
|
+
minor:
|
28
|
+
labels:
|
29
|
+
- 'minor'
|
30
|
+
patch:
|
31
|
+
labels:
|
32
|
+
- 'patch'
|
33
|
+
default: patch
|
34
|
+
|
35
|
+
exclude-labels:
|
36
|
+
- reverted
|
37
|
+
- no-changelog
|
38
|
+
- skip-changelog
|
39
|
+
- invalid
|
40
|
+
|
41
|
+
template: |
|
42
|
+
## [$RESOLVED_VERSION](https://github.com/finapps/ruby-client/compare/$PREVIOUS_TAG...$RESOLVED_VERSION)
|
43
|
+
$CHANGES
|
44
|
+
|
45
|
+
replacers:
|
46
|
+
- search: '/CVE-(\d{4})-(\d+)/g'
|
47
|
+
replace: 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-$1-$2'
|
48
|
+
- search: '@dependabot-preview'
|
49
|
+
replace: '@dependabot'
|
data/.github/workflows/main.yaml
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
name:
|
1
|
+
name: Continuous Integration
|
2
2
|
|
3
3
|
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
ci:
|
7
|
+
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
7
8
|
runs-on: ubuntu-latest
|
8
9
|
|
9
10
|
strategy:
|
@@ -17,7 +18,7 @@ jobs:
|
|
17
18
|
with:
|
18
19
|
ruby-version: '2.6'
|
19
20
|
|
20
|
-
- uses: actions/cache@
|
21
|
+
- uses: actions/cache@v2
|
21
22
|
with:
|
22
23
|
path: vendor/bundle
|
23
24
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
@@ -26,7 +27,7 @@ jobs:
|
|
26
27
|
|
27
28
|
- name: Install gems
|
28
29
|
run: |
|
29
|
-
gem install bundler
|
30
|
+
gem install -N bundler
|
30
31
|
bundle config path vendor/bundle
|
31
32
|
bundle install --jobs 4 --retry 3
|
32
33
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
name: Release Drafter
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
update_release_draft:
|
10
|
+
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: release-drafter/release-drafter@v5
|
14
|
+
env:
|
15
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
name: Bump version and Release
|
2
|
+
on:
|
3
|
+
release:
|
4
|
+
types: [published]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
release:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
fail-fast: true
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@master
|
14
|
+
with:
|
15
|
+
persist-credentials: false
|
16
|
+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
|
17
|
+
|
18
|
+
- uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: '2.6'
|
21
|
+
|
22
|
+
- name: Get version from latest tag
|
23
|
+
id: get_version
|
24
|
+
uses: battila7/get-version-action@v2
|
25
|
+
|
26
|
+
- name: Bump version
|
27
|
+
run: |
|
28
|
+
gem install -N gem-release
|
29
|
+
git config --local user.email "action@github.com"
|
30
|
+
git config --local user.name "GitHub Action"
|
31
|
+
gem bump --skip-ci --version ${{ steps.get_version.outputs.version-without-v }}
|
32
|
+
|
33
|
+
- name: Push changes
|
34
|
+
uses: ad-m/github-push-action@master
|
35
|
+
with:
|
36
|
+
# GitHub Actions token does not support pushing to protected branches.
|
37
|
+
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
38
|
+
#
|
39
|
+
# A manually populated`PERSONAL_ACCESS_TOKEN` environment variable
|
40
|
+
# with permissions to push to a protected branch must be used.
|
41
|
+
# not ideal - keep eyes open for a better solution
|
42
|
+
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
43
|
+
|
44
|
+
- name: Release gem to rubygems.org
|
45
|
+
run: |
|
46
|
+
set +x
|
47
|
+
mkdir -p ~/.gem
|
48
|
+
cat << EOF > ~/.gem/credentials
|
49
|
+
---
|
50
|
+
:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
|
51
|
+
EOF
|
52
|
+
chmod 0600 ~/.gem/credentials
|
53
|
+
set -x
|
54
|
+
gem release
|
@@ -0,0 +1,14 @@
|
|
1
|
+
name: "Require PR labels"
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [opened, labeled, unlabeled, synchronize]
|
6
|
+
jobs:
|
7
|
+
label:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: mheap/github-action-required-labels@v1
|
11
|
+
with:
|
12
|
+
mode: exactly
|
13
|
+
count: 1
|
14
|
+
labels: "bug, change, enhancement"
|
data/.rubocop.yml
CHANGED
@@ -10,6 +10,7 @@ AllCops:
|
|
10
10
|
- "vendor/**/*"
|
11
11
|
- "bin/**/*"
|
12
12
|
CacheRootDirectory: tmp
|
13
|
+
NewCops: enable
|
13
14
|
|
14
15
|
Layout/SpaceAroundMethodCallOperator:
|
15
16
|
Enabled: true
|
@@ -69,6 +70,8 @@ Naming/PredicateName:
|
|
69
70
|
|
70
71
|
RSpec/FilePath:
|
71
72
|
Enabled: false
|
73
|
+
Gemspec/RequiredRubyVersion:
|
74
|
+
Enabled: false
|
72
75
|
|
73
76
|
Style/RedundantRegexpCharacterClass:
|
74
77
|
Enabled: true
|
@@ -138,18 +141,8 @@ Style/OneLineConditional:
|
|
138
141
|
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
139
142
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
140
143
|
Enabled: false
|
141
|
-
Style/
|
142
|
-
Enabled:
|
143
|
-
Style/HashEachMethods:
|
144
|
-
Enabled: true
|
145
|
-
Style/HashTransformKeys:
|
146
|
-
Enabled: true
|
147
|
-
Style/HashTransformValues:
|
148
|
-
Enabled: true
|
149
|
-
Style/RedundantFetchBlock:
|
150
|
-
Enabled: true
|
151
|
-
Style/SlicingWithRange:
|
152
|
-
Enabled: true
|
144
|
+
Style/OptionalBooleanParameter:
|
145
|
+
Enabled: false
|
153
146
|
|
154
147
|
RSpec/NestedGroups:
|
155
148
|
Max: 5
|
data/.rubocop_todo.yml
CHANGED
data/RELEASES.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [5.0.36] - 2020-08-05
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
* Add upload endpoints to support dashboard ([#309][i309])
|
5
|
+
|
6
|
+
[i309]: https://github.com/finapps/tenant-dashboard-react/issues/309
|
7
|
+
|
8
|
+
[5.0.36]: https://github.com/finapps/ruby-client/compare/5.0.35...5.0.36
|
9
|
+
|
1
10
|
## [5.0.35] - 2020-07-09
|
2
11
|
|
3
12
|
### Changed
|
data/finapps.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
|
26
26
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
|
27
|
-
spec.add_development_dependency 'gem-release', '~> 2.1', '>= 2.1.1'
|
28
27
|
spec.add_development_dependency 'guard', '~> 2.16', '>= 2.16.1'
|
29
28
|
spec.add_development_dependency 'guard-rspec', '~> 4.7', '>= 4.7.3'
|
30
29
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
data/lib/finapps.rb
CHANGED
@@ -30,7 +30,9 @@ require 'finapps/rest/portfolios_consumers'
|
|
30
30
|
require 'finapps/rest/consumers_portfolios'
|
31
31
|
require 'finapps/rest/portfolio_reports'
|
32
32
|
require 'finapps/rest/documents_orders'
|
33
|
+
require 'finapps/rest/documents_uploads'
|
33
34
|
require 'finapps/rest/esign_templates'
|
35
|
+
require 'finapps/rest/documents_upload_types'
|
34
36
|
require 'finapps/rest/signed_documents_downloads'
|
35
37
|
require 'finapps/rest/documents_orders_notifications'
|
36
38
|
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FinApps
|
4
|
+
module REST
|
5
|
+
class DocumentsUploads < FinAppsCore::REST::Resources
|
6
|
+
def show(consumer_id, doc_id, thumbnail = false)
|
7
|
+
not_blank(consumer_id, :consumer_id)
|
8
|
+
not_blank(doc_id, :doc_id)
|
9
|
+
|
10
|
+
path =
|
11
|
+
"consumers/#{ERB::Util.url_encode(consumer_id)}/"\
|
12
|
+
"documents/#{ERB::Util.url_encode(doc_id)}?thumbnail=#{thumbnail}"
|
13
|
+
super(nil, path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def destroy(order_id, doc_id)
|
17
|
+
not_blank(order_id, :order_id)
|
18
|
+
not_blank(doc_id, :doc_id)
|
19
|
+
super(nil, "documents/orders/#{order_id}/#{doc_id}")
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy_by_consumer(consumer_id, document_id)
|
23
|
+
not_blank(consumer_id, :consumer_id)
|
24
|
+
not_blank(document_id, :document_id)
|
25
|
+
|
26
|
+
path = "consumers/#{consumer_id}/documents/#{document_id}"
|
27
|
+
send_request path, :delete
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/finapps/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helpers/client'
|
4
|
+
require 'rest/api_request'
|
5
|
+
|
6
|
+
RSpec.describe FinApps::REST::DocumentsUploadTypes do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
subject(:upload_types) { described_class.new(client).list }
|
9
|
+
|
10
|
+
let(:results) { upload_types[0] }
|
11
|
+
|
12
|
+
describe '#list' do
|
13
|
+
context 'when called' do
|
14
|
+
it_behaves_like 'an API request'
|
15
|
+
it_behaves_like 'a successful request'
|
16
|
+
it('performs a get and returns the response') do
|
17
|
+
expect(results[0]).to have_key(:type)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helpers/client'
|
4
|
+
require 'rest/api_request'
|
5
|
+
|
6
|
+
RSpec.describe FinApps::REST::DocumentsUploads do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
|
9
|
+
describe '#show' do
|
10
|
+
let(:upload) { described_class.new(client) }
|
11
|
+
|
12
|
+
context 'when missing doc id' do
|
13
|
+
subject(:show) { upload.show(:consumer_id, nil) }
|
14
|
+
|
15
|
+
it 'raises an error' do
|
16
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when missing consumer id' do
|
21
|
+
subject(:show) { upload.show(nil, :doc_id) }
|
22
|
+
|
23
|
+
it 'raises an error' do
|
24
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when thumbnail is not included' do
|
29
|
+
subject(:show) do
|
30
|
+
upload.show(
|
31
|
+
:consumer_id,
|
32
|
+
:doc_id
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
it_behaves_like 'an API request'
|
37
|
+
it_behaves_like 'a successful request'
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when thumbnail is included' do
|
41
|
+
subject(:show) do
|
42
|
+
upload.show(
|
43
|
+
:consumer_id,
|
44
|
+
:doc_id,
|
45
|
+
true
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
it_behaves_like 'an API request'
|
50
|
+
it_behaves_like 'a successful request'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#destroy' do
|
55
|
+
subject(:destroy) { described_class.new(client).destroy(order_id, doc_id) }
|
56
|
+
|
57
|
+
let(:results) { destroy[0] }
|
58
|
+
let(:error_messages) { destroy[1] }
|
59
|
+
|
60
|
+
context 'with valid id' do
|
61
|
+
let(:order_id) { :valid_order_id }
|
62
|
+
let(:doc_id) { :valid_doc_id }
|
63
|
+
|
64
|
+
it_behaves_like 'an API request'
|
65
|
+
it_behaves_like 'a successful request'
|
66
|
+
it('results is nil') { expect(results).to be_nil }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with invalid order id' do
|
70
|
+
let(:order_id) { :invalid_order_id }
|
71
|
+
let(:doc_id) { :valid_doc_id }
|
72
|
+
|
73
|
+
it_behaves_like 'an API request'
|
74
|
+
it('results is nil') { expect(results).to be_nil }
|
75
|
+
|
76
|
+
it('error messages array is populated') do
|
77
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with invalid doc id' do
|
82
|
+
let(:order_id) { :valid_order_id }
|
83
|
+
let(:doc_id) { :invalid_doc_id }
|
84
|
+
|
85
|
+
it_behaves_like 'an API request'
|
86
|
+
it('results is nil') { expect(results).to be_nil }
|
87
|
+
|
88
|
+
it('error messages array is populated') do
|
89
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'with missing id' do
|
94
|
+
let(:order_id) { nil }
|
95
|
+
let(:doc_id) { nil }
|
96
|
+
|
97
|
+
it do
|
98
|
+
expect { destroy }.to raise_error(
|
99
|
+
FinAppsCore::MissingArgumentsError
|
100
|
+
)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '#destroy_by_consumer' do
|
106
|
+
subject(:destroy_by_consumer) do
|
107
|
+
described_class.new(client).destroy_by_consumer(consumer_id, document_id)
|
108
|
+
end
|
109
|
+
|
110
|
+
let(:results) { destroy_by_consumer[0] }
|
111
|
+
let(:error_messages) { destroy_by_consumer[1] }
|
112
|
+
|
113
|
+
context 'with valid params' do
|
114
|
+
let(:consumer_id) { :valid_consumer_id }
|
115
|
+
let(:document_id) { :valid_document_id }
|
116
|
+
|
117
|
+
it_behaves_like 'an API request'
|
118
|
+
it_behaves_like 'a successful request'
|
119
|
+
it('results is nil') { expect(results).to be_nil }
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'with invalid consumer_id' do
|
123
|
+
let(:consumer_id) { :invalid_consumer_id }
|
124
|
+
let(:document_id) { :valid_document_id }
|
125
|
+
|
126
|
+
it_behaves_like 'an API request'
|
127
|
+
it('results is nil') { expect(results).to be_nil }
|
128
|
+
|
129
|
+
it('error messages array is populated') do
|
130
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'with invalid document id' do
|
135
|
+
let(:consumer_id) { :valid_consumer_id }
|
136
|
+
let(:document_id) { :invalid_document_id }
|
137
|
+
|
138
|
+
it_behaves_like 'an API request'
|
139
|
+
it('results is nil') { expect(results).to be_nil }
|
140
|
+
|
141
|
+
it('error messages array is populated') do
|
142
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'with missing id' do
|
147
|
+
let(:consumer_id) { nil }
|
148
|
+
let(:document_id) { nil }
|
149
|
+
|
150
|
+
it do
|
151
|
+
expect { destroy_by_consumer }.to raise_error(
|
152
|
+
FinAppsCore::MissingArgumentsError
|
153
|
+
)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|