finapps 5.0.45 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c79a7e77e6c6496121b61c0b2d37324ec7ca7aa9ff7f8c4153ebf4cb5a4d764b
4
- data.tar.gz: 2016bac07309e1817c0236ddb5b69f5cfb0577ff6c3af27d28ea195b9a56356e
3
+ metadata.gz: 1876da28473c212167549859f20839e6166cf63eb8175fdb787b1a3ddcd589ca
4
+ data.tar.gz: 1a6b376f154fc2b7dbdc4a935b30b5277c672ddf378e2a691ef0ebb40a29364e
5
5
  SHA512:
6
- metadata.gz: ce58b007e2b3122c2bb4b6ac8e1fd435da08c69e81de23e566488ca52ac4d626d57a814c14dcec667a92d413f93cf746380aeb487ea3b31b7c9fcea048adaa33
7
- data.tar.gz: 8642f81a12d89676bb95458a20d0eaa4ac1cc1be30d6384e2ba7a4a3960472f849aca73927bf11ac45045617904ec3a2cfafec48a7c3f34316e2df603b8447e1
6
+ metadata.gz: 6ea0899aaa9171da4a52e7b97ef2bfb2f20574fb6970af9c28bd935cfd3b660a271b32b0cf4d9a3c56839fa27dea373e8289cc64d7bcae6632f142de77010b7a
7
+ data.tar.gz: '016696c481689ca7817e2728a8aa7edbf337cd3fa0a075dec8f4d0254afda854d79baa5f42359dc804adb3d84f6cf45da96a760627478b13052cbccf116f494e'
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
@@ -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
- - uses: actions/checkout@master
14
- with:
15
- persist-credentials: false
16
- fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
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
- - 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
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
- - 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
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
@@ -48,7 +48,7 @@ Metrics/ClassLength:
48
48
  - app/controllers/orders_controller.rb
49
49
  - app/models/order.rb
50
50
  Metrics/BlockLength:
51
- ExcludedMethods: ['describe', 'context']
51
+ IgnoredMethods: ['describe', 'context']
52
52
  Exclude:
53
53
  - config/environments/**/**
54
54
  - Guardfile
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.6.3
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
- # Note: The cmd option is now required due to the increasing number of ways
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
- ## More Information
63
+ ### Release
64
64
 
65
- Please check the [FinApps wiki][wiki] for extended documentation.
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.10'
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.9', '>= 3.9.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.86', '>= 0.86.0'
32
- spec.add_development_dependency 'rubocop-performance', '~> 1.6', '>= 1.6.1'
33
- spec.add_development_dependency 'rubocop-rspec', '~> 1.40', '>= 1.40.0'
34
- spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.8'
35
- spec.add_development_dependency 'webmock', '~> 3.8', '>= 3.8.0'
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'
@@ -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]*/) { $&.capitalize }
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
- {"email": term},
66
- {"first_name": term},
67
- {"last_name": term}
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("first_name": t)
76
- search_arr.append("last_name": t)
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
- super(id, "documents/orders/#{id}")
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]))
@@ -71,22 +90,21 @@ module FinApps
71
90
  end
72
91
 
73
92
  def with_space_search(term)
74
- [
75
- {"applicant.email": term},
76
- {"applicant.first_name": term},
77
- {"applicant.last_name": term},
78
- {
79
- "reference_no": {
80
- "$regex": "^#{term}", "$options": 'i'
81
- }
82
- }
83
- ]
93
+ [{"applicant.email": term},
94
+ {"applicant.first_name": term},
95
+ {"applicant.last_name": term},
96
+ {"applicant.external_id": term},
97
+ {
98
+ reference_no: {
99
+ "$regex": "^#{term}", "$options": 'i'
100
+ }
101
+ }]
84
102
  end
85
103
 
86
104
  def tag_query(tag)
87
105
  return {} unless tag
88
106
 
89
- {"tag": tag.empty? ? nil : tag}
107
+ {tag: tag.empty? ? nil : tag}
90
108
  end
91
109
 
92
110
  def status_query(status)
@@ -98,7 +116,7 @@ module FinApps
98
116
  def consumer_query(consumer)
99
117
  return {} unless consumer
100
118
 
101
- {"consumer_id": consumer.empty? ? nil : consumer}
119
+ {consumer_id: consumer.empty? ? nil : consumer}
102
120
  end
103
121
  end
104
122
  end
@@ -64,14 +64,14 @@ module FinApps
64
64
  end
65
65
 
66
66
  def search_query(term)
67
- {"last_name": term}
67
+ {last_name: term}
68
68
  end
69
69
 
70
70
  def role_query(role)
71
71
  if role.is_a?(Array)
72
- {"role": {"$in": role.map(&:to_i)}}
72
+ {role: {"$in": role.map(&:to_i)}}
73
73
  else
74
- {"role": role.to_i}
74
+ {role: role.to_i}
75
75
  end
76
76
  end
77
77
  end
@@ -81,7 +81,7 @@ module FinApps
81
81
  end
82
82
 
83
83
  def search_query_object(term)
84
- [{"public_id": {"$regex": "^#{term}", "$options": 'i'}},
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
- {"status": {"$in": status.map(&:to_i)}}
98
+ {status: {"$in": status.map(&:to_i)}}
99
99
  else
100
- {"status": status.to_i}
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
- {"consumer_id": consumer.empty? ? nil : consumer}
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
- {"public_id": {"$in": relation}},
129
- {"original_order_id": {"$in": relation}}
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