finapps 5.0.44 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +47 -0
- data/.github/workflows/release.yml +42 -42
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/Guardfile +1 -1
- data/README.md +6 -4
- data/finapps.gemspec +8 -7
- data/lib/finapps.rb +1 -0
- data/lib/finapps/rest/client.rb +2 -1
- data/lib/finapps/rest/consumers.rb +5 -5
- data/lib/finapps/rest/documents_orders.rb +23 -4
- data/lib/finapps/rest/documents_orders_notifications.rb +2 -2
- data/lib/finapps/rest/operators.rb +3 -3
- data/lib/finapps/rest/orders.rb +6 -6
- data/lib/finapps/rest/screenings.rb +71 -0
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/api_request.rb +8 -0
- data/spec/rest/documents_orders_notifications_spec.rb +2 -2
- data/spec/rest/documents_orders_spec.rb +37 -31
- data/spec/rest/screenings_spec.rb +251 -0
- data/spec/support/fake_api.rb +12 -0
- data/spec/support/fixtures/documents/retrieve_order.json +97 -0
- data/spec/support/fixtures/screening.json +26 -0
- data/spec/support/fixtures/screening_invalid_update.json +5 -0
- data/spec/support/fixtures/screening_list.json +25 -0
- data/spec/support/fixtures/screenings/last_session.json +13 -0
- data/spec/support/fixtures/screenings/session_not_found_with_id.json +5 -0
- data/spec/support/fixtures/session_not_found.json +5 -0
- data/spec/support/screenings_routes.rb +72 -0
- metadata +115 -83
- data/.github/workflows/main.yaml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 554b65d6356fd5e7b4e6c6711af7b915285353a34f88e6c95f73305573da56b5
|
4
|
+
data.tar.gz: 7b2d81aeba357ae0c8cdf7b6688ab4b7f5017a75c840ee6f09e095c1c64bd085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36390552ea22bf844baab8585a516e54cfa9e22267159f426d0ce94baae60163823b2dfe364828f8b039abdbf6ac1930c4105eea532f7667ed95687074829a49
|
7
|
+
data.tar.gz: 3942cfe7e696a6560f78bf0e5ead716831a7698b13b513b175d9af4f38382f4c4e457f2758f3053d596c3f37b99984ecf3cd3006f9f470afd644549a294f9362
|
@@ -0,0 +1,47 @@
|
|
1
|
+
name: Continuous Integration
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths-ignore:
|
6
|
+
- ".github/**"
|
7
|
+
- ".VERSION"
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- ".github/**"
|
11
|
+
- ".VERSION"
|
12
|
+
jobs:
|
13
|
+
tests:
|
14
|
+
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
strategy:
|
18
|
+
fail-fast: true
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- name: Checkout source code
|
22
|
+
uses: actions/checkout@v2
|
23
|
+
|
24
|
+
- name: Install required ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
|
27
|
+
- name: Setup cache key and directory for gems cache
|
28
|
+
uses: actions/cache@v2
|
29
|
+
with:
|
30
|
+
path: vendor/bundle
|
31
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
32
|
+
restore-keys: |
|
33
|
+
${{ runner.os }}-gems-
|
34
|
+
|
35
|
+
- name: Bundle install
|
36
|
+
run: |
|
37
|
+
bundle config path vendor/bundle
|
38
|
+
bundle config set jobs 4
|
39
|
+
bundle config set retry 3
|
40
|
+
bundle install
|
41
|
+
|
42
|
+
- name: Run rubocop
|
43
|
+
run: |
|
44
|
+
bundle exec rubocop --parallel
|
45
|
+
|
46
|
+
- name: Run tests
|
47
|
+
run: bundle exec rspec
|
@@ -2,53 +2,53 @@ name: Bump version and Release
|
|
2
2
|
on:
|
3
3
|
release:
|
4
4
|
types: [published]
|
5
|
-
|
5
|
+
|
6
6
|
jobs:
|
7
7
|
release:
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
strategy:
|
10
10
|
fail-fast: true
|
11
11
|
|
12
|
-
steps:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
steps:
|
13
|
+
- name: Checkout source code
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
persist-credentials: false
|
17
|
+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
18
|
+
|
19
|
+
- name: Install required ruby version
|
20
|
+
uses: ruby/setup-ruby@v1
|
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 }}
|
17
32
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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 }}
|
25
43
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
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
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.2
|
data/Guardfile
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
19
|
|
20
|
-
#
|
20
|
+
# NOTE: The cmd option is now required due to the increasing number of ways
|
21
21
|
# rspec may be run, below are examples of the most common uses.
|
22
22
|
# * bundler: 'bundle exec rspec'
|
23
23
|
# * bundler binstubs: 'bin/rspec'
|
data/README.md
CHANGED
@@ -60,18 +60,20 @@ company_token = 'my-company-token'
|
|
60
60
|
@client = FinApps::REST::Client.new company_identifier, company_token
|
61
61
|
```
|
62
62
|
|
63
|
-
|
63
|
+
### Release
|
64
64
|
|
65
|
-
|
65
|
+
For approved Pull Requests against the master branch, an aggregated release draft will be generated. This draft by default bumps the patch number of previous version.
|
66
|
+
Please refer to the [Release Drafter] action documentation for information on this process, specifically how to bump the major or minor numbers of the gem version.
|
66
67
|
|
68
|
+
As soon as this draft is converted into an actual release, an automated process also running on GitHub actions will be triggered to build the gem and release it to rubygems.org.
|
67
69
|
|
68
|
-
[FinancialApps.com][financialapps]
|
69
70
|
|
71
|
+
[FinancialApps.com][financialapps]
|
70
72
|
|
71
73
|
[bundler]: http://bundler.io
|
72
74
|
[financialapps]: https://financialapps.com
|
73
|
-
[wiki]: https://github.com/finapps/ruby-client/wiki
|
74
75
|
[builder]: http://builder.rubyforge.org/
|
75
76
|
[bundler]: http://bundler.io
|
76
77
|
[rubygems]: http://rubygems.org
|
77
78
|
[build_status]: http://teamciti.powerwallet.com/viewType.html?buildTypeId=FaRuby_BuildMaster&guest=1
|
79
|
+
[Release Drafter]: https://github.com/release-drafter/release-drafter
|
data/finapps.gemspec
CHANGED
@@ -20,19 +20,20 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = Dir['spec/**/*.rb']
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'finapps_core', '~> 5.0', '>= 5.0.
|
23
|
+
spec.add_runtime_dependency 'finapps_core', '~> 5.0', '>= 5.0.15'
|
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
27
|
spec.add_development_dependency 'guard', '~> 2.16', '>= 2.16.1'
|
28
28
|
spec.add_development_dependency 'guard-rspec', '~> 4.7', '>= 4.7.3'
|
29
29
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
30
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
31
|
-
spec.add_development_dependency 'rubocop', '~>
|
32
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
33
|
-
spec.add_development_dependency 'rubocop-
|
34
|
-
spec.add_development_dependency '
|
35
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.10', '>= 3.10.0'
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 1.9', '>= 1.9.1'
|
32
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.9', '>= 1.9.2'
|
33
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5', '>= 0.5.1'
|
34
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.2', '>= 2.2.0'
|
35
|
+
spec.add_development_dependency 'sinatra', '~> 2.1', '>= 2.1.0'
|
36
|
+
spec.add_development_dependency 'webmock', '~> 3.11', '>= 3.11.2'
|
36
37
|
|
37
38
|
spec.extra_rdoc_files = %w[README.md LICENSE.txt]
|
38
39
|
spec.rdoc_options = %w[--line-numbers --inline-source --title finapps-ruby --main README.md]
|
data/lib/finapps.rb
CHANGED
@@ -35,6 +35,7 @@ require 'finapps/rest/esign_templates'
|
|
35
35
|
require 'finapps/rest/documents_upload_types'
|
36
36
|
require 'finapps/rest/signed_documents_downloads'
|
37
37
|
require 'finapps/rest/documents_orders_notifications'
|
38
|
+
require 'finapps/rest/screenings'
|
38
39
|
|
39
40
|
require 'finapps/rest/plaid/plaid_resources'
|
40
41
|
require 'finapps/rest/plaid/plaid_webhooks'
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -37,6 +37,7 @@ module FinApps
|
|
37
37
|
portfolios_consumers
|
38
38
|
portfolio_reports
|
39
39
|
products
|
40
|
+
screenings
|
40
41
|
sessions
|
41
42
|
signed_documents_downloads
|
42
43
|
tenant_settings
|
@@ -82,7 +83,7 @@ module FinApps
|
|
82
83
|
|
83
84
|
def camelize(term)
|
84
85
|
string = term.to_s
|
85
|
-
string = string.sub(/^[a-z\d]*/) {
|
86
|
+
string = string.sub(/^[a-z\d]*/) { Regexp.last_match(0).capitalize }
|
86
87
|
string.gsub(%r{(?:_|(/))([a-z\d]*)}) do
|
87
88
|
Regexp.last_match(2).capitalize.to_s
|
88
89
|
end
|
@@ -62,9 +62,9 @@ module FinApps
|
|
62
62
|
|
63
63
|
def with_space_search(term)
|
64
64
|
[
|
65
|
-
{
|
66
|
-
{
|
67
|
-
{
|
65
|
+
{email: term},
|
66
|
+
{first_name: term},
|
67
|
+
{last_name: term}
|
68
68
|
]
|
69
69
|
end
|
70
70
|
|
@@ -72,8 +72,8 @@ module FinApps
|
|
72
72
|
search_arr = []
|
73
73
|
if /\s/.match?(term)
|
74
74
|
term.split.each do |t|
|
75
|
-
search_arr.append(
|
76
|
-
search_arr.append(
|
75
|
+
search_arr.append(first_name: t)
|
76
|
+
search_arr.append(last_name: t)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
search_arr
|
@@ -17,7 +17,12 @@ module FinApps
|
|
17
17
|
|
18
18
|
def show(id)
|
19
19
|
not_blank(id, :order_id)
|
20
|
-
|
20
|
+
|
21
|
+
if matches_token_format?(id)
|
22
|
+
show_by_token id
|
23
|
+
else
|
24
|
+
show_by_id id
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
def create(params)
|
@@ -45,6 +50,20 @@ module FinApps
|
|
45
50
|
|
46
51
|
private
|
47
52
|
|
53
|
+
def show_by_id(id)
|
54
|
+
path = "documents/orders/#{id}"
|
55
|
+
send_request path, :get
|
56
|
+
end
|
57
|
+
|
58
|
+
def show_by_token(jwt)
|
59
|
+
path = "documents/retrieve_order?token=#{jwt}"
|
60
|
+
send_request path, :get
|
61
|
+
end
|
62
|
+
|
63
|
+
def matches_token_format?(str)
|
64
|
+
str.match(/^.+\..+\..+$/)
|
65
|
+
end
|
66
|
+
|
48
67
|
def build_filter(params)
|
49
68
|
search_query(params[:searchTerm])
|
50
69
|
.merge(consumer_query(params[:consumer]))
|
@@ -76,7 +95,7 @@ module FinApps
|
|
76
95
|
{"applicant.first_name": term},
|
77
96
|
{"applicant.last_name": term},
|
78
97
|
{
|
79
|
-
|
98
|
+
reference_no: {
|
80
99
|
"$regex": "^#{term}", "$options": 'i'
|
81
100
|
}
|
82
101
|
}
|
@@ -86,7 +105,7 @@ module FinApps
|
|
86
105
|
def tag_query(tag)
|
87
106
|
return {} unless tag
|
88
107
|
|
89
|
-
{
|
108
|
+
{tag: tag.empty? ? nil : tag}
|
90
109
|
end
|
91
110
|
|
92
111
|
def status_query(status)
|
@@ -98,7 +117,7 @@ module FinApps
|
|
98
117
|
def consumer_query(consumer)
|
99
118
|
return {} unless consumer
|
100
119
|
|
101
|
-
{
|
120
|
+
{consumer_id: consumer.empty? ? nil : consumer}
|
102
121
|
end
|
103
122
|
end
|
104
123
|
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module FinApps
|
4
4
|
module REST
|
5
5
|
class DocumentsOrdersNotifications < FinAppsCore::REST::Resources
|
6
|
-
def create(id)
|
6
|
+
def create(id, params = [])
|
7
7
|
not_blank(id, :id)
|
8
8
|
|
9
9
|
path = "documents/orders/#{ERB::Util.url_encode(id)}/notify"
|
10
|
-
super
|
10
|
+
super params, path
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -64,14 +64,14 @@ module FinApps
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def search_query(term)
|
67
|
-
{
|
67
|
+
{last_name: term}
|
68
68
|
end
|
69
69
|
|
70
70
|
def role_query(role)
|
71
71
|
if role.is_a?(Array)
|
72
|
-
{
|
72
|
+
{role: {"$in": role.map(&:to_i)}}
|
73
73
|
else
|
74
|
-
{
|
74
|
+
{role: role.to_i}
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
data/lib/finapps/rest/orders.rb
CHANGED
@@ -81,7 +81,7 @@ module FinApps
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def search_query_object(term)
|
84
|
-
[{
|
84
|
+
[{public_id: {"$regex": "^#{term}", "$options": 'i'}},
|
85
85
|
{"assignment.last_name": term},
|
86
86
|
{"applicant.first_name": term},
|
87
87
|
{"applicant.last_name": term},
|
@@ -95,9 +95,9 @@ module FinApps
|
|
95
95
|
def status_query(status)
|
96
96
|
if status
|
97
97
|
if status.is_a?(Array)
|
98
|
-
{
|
98
|
+
{status: {"$in": status.map(&:to_i)}}
|
99
99
|
else
|
100
|
-
{
|
100
|
+
{status: status.to_i}
|
101
101
|
end
|
102
102
|
else
|
103
103
|
{}
|
@@ -115,7 +115,7 @@ module FinApps
|
|
115
115
|
|
116
116
|
def consumer_query(consumer)
|
117
117
|
if consumer
|
118
|
-
{
|
118
|
+
{consumer_id: consumer.empty? ? nil : consumer}
|
119
119
|
else
|
120
120
|
{}
|
121
121
|
end
|
@@ -125,8 +125,8 @@ module FinApps
|
|
125
125
|
if !search_term && !nil_or_empty?(relation)
|
126
126
|
{
|
127
127
|
"$or": [
|
128
|
-
{
|
129
|
-
{
|
128
|
+
{public_id: {"$in": relation}},
|
129
|
+
{original_order_id: {"$in": relation}}
|
130
130
|
]
|
131
131
|
}
|
132
132
|
else
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../utils/query_builder'
|
4
|
+
|
5
|
+
module FinApps
|
6
|
+
module REST
|
7
|
+
class Screenings < FinAppsCore::REST::Resources # :nodoc:
|
8
|
+
include FinApps::Utils::QueryBuilder
|
9
|
+
|
10
|
+
def show(id)
|
11
|
+
not_blank(id, :session_id)
|
12
|
+
|
13
|
+
path = "#{end_point}/#{ERB::Util.url_encode(id)}/resume"
|
14
|
+
super(nil, path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def last(consumer_id)
|
18
|
+
not_blank(consumer_id, :consumer_id)
|
19
|
+
|
20
|
+
path = "#{end_point}/#{ERB::Util.url_encode(consumer_id)}/consumer"
|
21
|
+
send_request_for_id path, :get, nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def create(params)
|
25
|
+
not_blank(params, :params)
|
26
|
+
super params
|
27
|
+
end
|
28
|
+
|
29
|
+
def list(params = nil)
|
30
|
+
return super if params.nil?
|
31
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
32
|
+
|
33
|
+
super build_query_path(end_point, params)
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(id, params)
|
37
|
+
not_blank(id, :session_id)
|
38
|
+
not_blank(params, :params)
|
39
|
+
|
40
|
+
path = "#{end_point}/#{ERB::Util.url_encode(id)}"
|
41
|
+
super params, path
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy(id)
|
45
|
+
not_blank(id, :session_id)
|
46
|
+
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def build_filter(params)
|
53
|
+
search_query(params[:searchTerm])
|
54
|
+
end
|
55
|
+
|
56
|
+
def search_query(term)
|
57
|
+
return {} unless term
|
58
|
+
|
59
|
+
query = search_query_object(term)
|
60
|
+
{"$or": query}
|
61
|
+
end
|
62
|
+
|
63
|
+
def search_query_object(term)
|
64
|
+
[
|
65
|
+
{"consumer.public_id": term},
|
66
|
+
{"consumer.email": term}
|
67
|
+
]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|