finapps 5.0.33 → 5.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/release-drafter.yml +49 -0
  3. data/.github/workflows/main.yaml +38 -0
  4. data/.github/workflows/release-drafter.yml +15 -0
  5. data/.github/workflows/release.yml +43 -0
  6. data/.github/workflows/verify-pr-labeled.yml +14 -0
  7. data/.rubocop.yml +5 -12
  8. data/.rubocop_todo.yml +4 -95
  9. data/README.md +1 -0
  10. data/RELEASES.md +20 -0
  11. data/finapps.gemspec +1 -2
  12. data/lib/finapps.rb +2 -0
  13. data/lib/finapps/rest/client.rb +8 -5
  14. data/lib/finapps/rest/documents_orders.rb +1 -1
  15. data/lib/finapps/rest/documents_upload_types.rb +11 -0
  16. data/lib/finapps/rest/documents_uploads.rb +23 -0
  17. data/lib/finapps/rest/orders.rb +26 -15
  18. data/lib/finapps/rest/sessions.rb +10 -8
  19. data/lib/finapps/utils/query_builder.rb +13 -4
  20. data/lib/finapps/version.rb +1 -1
  21. data/spec/rest/alert_definitions_spec.rb +2 -6
  22. data/spec/rest/client_spec.rb +32 -40
  23. data/spec/rest/consumers_spec.rb +221 -220
  24. data/spec/rest/documents_orders_notifications_spec.rb +1 -1
  25. data/spec/rest/documents_orders_spec.rb +1 -1
  26. data/spec/rest/documents_upload_types_spec.rb +21 -0
  27. data/spec/rest/documents_uploads_spec.rb +104 -0
  28. data/spec/rest/operators_password_resets_spec.rb +49 -56
  29. data/spec/rest/operators_spec.rb +167 -178
  30. data/spec/rest/order_notifications_spec.rb +1 -1
  31. data/spec/rest/order_refreshes_spec.rb +2 -5
  32. data/spec/rest/order_reports_spec.rb +14 -14
  33. data/spec/rest/order_statuses_spec.rb +10 -10
  34. data/spec/rest/order_tokens_spec.rb +33 -32
  35. data/spec/rest/orders_spec.rb +78 -64
  36. data/spec/rest/password_resets_spec.rb +28 -28
  37. data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +1 -1
  38. data/spec/rest/portfolios_alerts_spec.rb +3 -3
  39. data/spec/rest/portfolios_consumers_spec.rb +2 -2
  40. data/spec/rest/portfolios_spec.rb +6 -18
  41. data/spec/rest/products_spec.rb +16 -15
  42. data/spec/rest/sessions_spec.rb +61 -60
  43. data/spec/rest/signed_documents_downloads_spec.rb +8 -4
  44. data/spec/rest/verix/verix_documents_spec.rb +2 -2
  45. data/spec/rest/version_spec.rb +4 -4
  46. data/spec/support/fake_api.rb +16 -1
  47. data/spec/support/fixtures/upload_types.json +9 -0
  48. metadata +70 -79
  49. data/lib/tasks/releaser.rake +0 -12
@@ -5,39 +5,39 @@ RSpec.describe FinApps::REST::PasswordResets do
5
5
 
6
6
  describe '#create' do
7
7
  context 'when missing id' do
8
- subject { described_class.new(client).create(nil) }
8
+ subject(:create) { described_class.new(client).create(nil) }
9
9
 
10
10
  it do
11
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
11
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
12
12
  end
13
13
  end
14
14
 
15
15
  context 'when invalid id is provided' do
16
- subject do
16
+ subject(:create) do
17
17
  described_class.new(client).create(:invalid_user_id)
18
18
  end
19
19
 
20
- it { expect { subject }.not_to raise_error }
21
- it('results is nil') { expect(subject[0]).to be_nil }
20
+ it { expect { create }.not_to raise_error }
21
+ it('results is nil') { expect(create[0]).to be_nil }
22
22
 
23
23
  it('error messages array is populated') do
24
- expect(subject[1]).not_to be_nil
24
+ expect(create[1]).not_to be_nil
25
25
  end
26
26
  end
27
27
 
28
28
  context 'when valid id is provided' do
29
- subject do
29
+ subject(:create) do
30
30
  described_class.new(client).create(:valid_user_id)
31
31
  end
32
32
 
33
- it { expect { subject }.not_to raise_error }
34
- it('returns an array') { expect(subject).to be_a(Array) }
33
+ it { expect { create }.not_to raise_error }
34
+ it('returns an array') { expect(create).to be_a(Array) }
35
35
 
36
36
  it('performs a post and returns the response') do
37
- expect(subject[0]).to have_key(:token)
37
+ expect(create[0]).to have_key(:token)
38
38
  end
39
39
 
40
- it('returns no error messages') { expect(subject[1]).to be_empty }
40
+ it('returns no error messages') { expect(create[1]).to be_empty }
41
41
  end
42
42
  end
43
43
 
@@ -46,71 +46,71 @@ RSpec.describe FinApps::REST::PasswordResets do
46
46
  let(:invalid_params) { {token: 'invalid_token'} }
47
47
 
48
48
  context 'when missing id' do
49
- subject { described_class.new(client).update(nil, :params) }
49
+ subject(:update) { described_class.new(client).update(nil, :params) }
50
50
 
51
51
  it do
52
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
52
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
53
53
  end
54
54
  end
55
55
 
56
56
  context 'when missing params' do
57
- subject do
57
+ subject(:update) do
58
58
  described_class.new(client).update(:valid_user_id, nil)
59
59
  end
60
60
 
61
61
  it do
62
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
62
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
63
63
  end
64
64
  end
65
65
 
66
66
  context 'when invalid id is provided' do
67
- subject do
67
+ subject(:update) do
68
68
  described_class.new(client).update(
69
69
  :invalid_user_id,
70
70
  valid_params
71
71
  )
72
72
  end
73
73
 
74
- it { expect { subject }.not_to raise_error }
75
- it('results is nil') { expect(subject[0]).to be_nil }
74
+ it { expect { update }.not_to raise_error }
75
+ it('results is nil') { expect(update[0]).to be_nil }
76
76
 
77
77
  it('error messages array is populated') do
78
- expect(subject[1]).not_to be_nil
78
+ expect(update[1]).not_to be_nil
79
79
  end
80
80
  end
81
81
 
82
82
  context 'when invalid params are provided' do
83
- subject do
83
+ subject(:update) do
84
84
  described_class.new(client).update(
85
85
  :valid_user_id,
86
86
  invalid_params
87
87
  )
88
88
  end
89
89
 
90
- it { expect { subject }.not_to raise_error }
91
- it('results is nil') { expect(subject[0]).to be_nil }
90
+ it { expect { update }.not_to raise_error }
91
+ it('results is nil') { expect(update[0]).to be_nil }
92
92
 
93
93
  it('error messages array is populated') do
94
- expect(subject[1]).not_to be_nil
94
+ expect(update[1]).not_to be_nil
95
95
  end
96
96
  end
97
97
 
98
98
  context 'when valid params are provided' do
99
- subject do
99
+ subject(:update) do
100
100
  described_class.new(client).update(
101
101
  :valid_user_id,
102
102
  valid_params
103
103
  )
104
104
  end
105
105
 
106
- it { expect { subject }.not_to raise_error }
107
- it('returns an array') { expect(subject).to be_a(Array) }
106
+ it { expect { update }.not_to raise_error }
107
+ it('returns an array') { expect(update).to be_a(Array) }
108
108
 
109
109
  it('performs a post and returns the response') do
110
- expect(subject[0]).to have_key(:token)
110
+ expect(update[0]).to have_key(:token)
111
111
  end
112
112
 
113
- it('returns no error messages') { expect(subject[1]).to be_empty }
113
+ it('returns no error messages') { expect(update[1]).to be_empty }
114
114
  end
115
115
  end
116
116
  end
@@ -48,7 +48,7 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
48
48
  it_behaves_like 'a successful request'
49
49
  it_behaves_like 'a request that returns institution data'
50
50
  it('returns institution account data') do
51
- expect(subject[RESULTS]).to have_key(:accounts)
51
+ expect(show[RESULTS]).to have_key(:accounts)
52
52
  end
53
53
  end
54
54
  end
@@ -23,12 +23,12 @@ RSpec.describe FinApps::REST::PortfoliosAlerts do
23
23
  it { expect { list }.not_to raise_error }
24
24
  it('returns an array') { expect(list).to be_a(Array) }
25
25
 
26
- it('performs a get and returns array of alert definitions') do
26
+ it('performs a get and returns a results array') do
27
27
  expect(results).to be_a(Array)
28
- expect(results.first).to have_key(:_id)
29
- expect(results.first).to have_key(:rule_name)
30
28
  end
31
29
 
30
+ it { expect(results.first).to have_key(:_id) }
31
+ it { expect(results.first).to have_key(:rule_name) }
32
32
  it('returns no error messages') { expect(errors).to be_empty }
33
33
  end
34
34
 
@@ -97,7 +97,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
97
97
  end
98
98
  end
99
99
 
100
- context 'for bulk subscribe' do
100
+ context 'with bulk subscribe' do
101
101
  context 'when valid id and params are provided' do
102
102
  let(:portfolio_id) { 'valid_id' }
103
103
  let(:params) { %w[id1 id2 id3] }
@@ -130,7 +130,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
130
130
  end
131
131
  end
132
132
 
133
- context 'for single subscribe' do
133
+ context 'with single subscribe' do
134
134
  context 'when valid ids are provided' do
135
135
  let(:portfolio_id) { 'valid_id' }
136
136
  let(:params) { portfolio_id }
@@ -67,12 +67,8 @@ RSpec.describe FinApps::REST::Portfolios do
67
67
 
68
68
  it { expect { show }.not_to raise_error }
69
69
  it('returns an array') { expect(show).to be_a(Array) }
70
-
71
- it('performs a get and returns the response') do
72
- expect(results).to have_key(:_id)
73
- expect(results).to have_key(:product)
74
- end
75
-
70
+ it { expect(results).to have_key(:_id) }
71
+ it { expect(results).to have_key(:product) }
76
72
  it('returns no error messages') { expect(errors).to be_empty }
77
73
  end
78
74
 
@@ -112,12 +108,8 @@ RSpec.describe FinApps::REST::Portfolios do
112
108
 
113
109
  it { expect { create }.not_to raise_error }
114
110
  it('returns an array') { expect(create).to be_a(Array) }
115
-
116
- it('performs a get and returns the response') do
117
- expect(results).to have_key(:_id)
118
- expect(results).to have_key(:product)
119
- end
120
-
111
+ it { expect(results).to have_key(:_id) }
112
+ it { expect(results).to have_key(:product) }
121
113
  it('returns no error messages') { expect(errors).to be_empty }
122
114
  end
123
115
 
@@ -180,12 +172,8 @@ RSpec.describe FinApps::REST::Portfolios do
180
172
 
181
173
  it { expect { update }.not_to raise_error }
182
174
  it('returns an array') { expect(update).to be_a(Array) }
183
-
184
- it('performs a get and returns the response') do
185
- expect(results).to have_key(:_id)
186
- expect(results).to have_key(:product)
187
- end
188
-
175
+ it { expect(results).to have_key(:_id) }
176
+ it { expect(results).to have_key(:product) }
189
177
  it('returns no error messages') { expect(errors).to be_empty }
190
178
  end
191
179
  end
@@ -2,25 +2,26 @@
2
2
 
3
3
  require 'spec_helpers/client'
4
4
 
5
- RSpec.describe FinApps::REST::Products,
6
- 'initialized with valid FinApps::Client object' do
7
- include SpecHelpers::Client
8
- subject(:products) { described_class.new(client) }
5
+ RSpec.describe FinApps::REST::Products do
6
+ context 'when initialized with valid FinApps::Client object' do
7
+ include SpecHelpers::Client
8
+ subject(:products) { described_class.new(client) }
9
9
 
10
- describe '#list' do
11
- context 'when called' do
12
- let(:list) { subject.list }
13
- let(:results) { list[0] }
14
- let(:error_messages) { list[1] }
10
+ describe '#list' do
11
+ context 'when called' do
12
+ let(:list) { subject.list }
13
+ let(:results) { list[0] }
14
+ let(:error_messages) { list[1] }
15
15
 
16
- it { expect { list }.not_to raise_error }
17
- it('returns an array of records') { expect(results).to be_a(Array) }
16
+ it { expect { list }.not_to raise_error }
17
+ it('returns an array of records') { expect(results).to be_a(Array) }
18
18
 
19
- it('performs a get and returns the response') do
20
- expect(results[0]).to have_key(:code)
21
- end
19
+ it('performs a get and returns the response') do
20
+ expect(results[0]).to have_key(:code)
21
+ end
22
22
 
23
- it('returns no error messages') { expect(error_messages).to be_empty }
23
+ it('returns no error messages') { expect(error_messages).to be_empty }
24
+ end
24
25
  end
25
26
  end
26
27
  end
@@ -2,80 +2,81 @@
2
2
 
3
3
  require 'spec_helpers/client'
4
4
 
5
- RSpec.describe FinApps::REST::Sessions,
6
- 'initialized with valid FinApps::Client object' do
7
- include SpecHelpers::Client
8
- subject { described_class.new(client) }
9
-
10
- describe '#create' do
11
- let(:create) { subject.create(credentials) }
12
- let(:results) { create[0] }
13
- let(:error_messages) { create[1] }
14
-
15
- context 'when missing email or password' do
16
- message = 'Invalid argument: params.'
17
- it do
18
- expect do
19
- subject.create(email: nil, password: 'password')
20
- end.to raise_error(FinAppsCore::InvalidArgumentsError, message)
5
+ RSpec.describe FinApps::REST::Sessions do
6
+ context 'when initialized with valid FinApps::Client object' do
7
+ include SpecHelpers::Client
8
+ subject(:session) { described_class.new(client) }
9
+
10
+ describe '#create' do
11
+ let(:create) { session.create(credentials) }
12
+ let(:results) { create[0] }
13
+ let(:error_messages) { create[1] }
14
+
15
+ context 'when missing email or password' do
16
+ message = 'Invalid argument: params.'
17
+ it do
18
+ expect do
19
+ session.create(email: nil, password: 'password')
20
+ end.to raise_error(FinAppsCore::InvalidArgumentsError, message)
21
+ end
22
+
23
+ it do
24
+ expect { session.create(email: 'email', password: nil) }.to raise_error(
25
+ FinAppsCore::InvalidArgumentsError,
26
+ message
27
+ )
28
+ end
21
29
  end
22
30
 
23
- it do
24
- expect { subject.create(email: 'email', password: nil) }.to raise_error(
25
- FinAppsCore::InvalidArgumentsError,
26
- message
27
- )
28
- end
29
- end
31
+ context 'with invalid credentials' do
32
+ let(:credentials) do
33
+ {email: 'email@domain.com', password: 'invalid_password'}
34
+ end
30
35
 
31
- context 'for invalid credentials' do
32
- let(:credentials) do
33
- {email: 'email@domain.com', password: 'invalid_password'}
36
+ it { expect { create }.not_to raise_error }
37
+ it('results is nil') { expect(results).to be_nil }
38
+
39
+ error_message = 'Invalid Consumer Identifier or Credentials'
40
+ it('error_messages are populated') do
41
+ expect(error_messages.first).to eq(error_message)
42
+ end
34
43
  end
35
44
 
36
- it { expect { create }.not_to raise_error }
37
- it('results is nil') { expect(results).to be_nil }
45
+ context 'with valid credentials' do
46
+ let(:credentials) do
47
+ {email: 'email@domain.com', password: 'valid_password'}
48
+ end
38
49
 
39
- error_message = 'Invalid Consumer Identifier or Credentials'
40
- it('error_messages are populated') do
41
- expect(error_messages.first).to eq(error_message)
50
+ it('results is a Hash') { expect(results).to be_a(Hash) }
51
+ it('token value is in the result') { expect(results).to have_key(:token) }
52
+ it('error_messages is empty') { expect(error_messages).to be_empty }
42
53
  end
43
- end
44
54
 
45
- context 'for valid credentials' do
46
- let(:credentials) do
47
- {email: 'email@domain.com', password: 'valid_password'}
48
- end
55
+ context 'with valid credentials & path argument' do
56
+ let(:create) { subject.create(credentials, 'operators/login') }
57
+ let(:credentials) do
58
+ {email: 'email@domain.com', password: 'valid_password'}
59
+ end
49
60
 
50
- it('results is a Hash') { expect(results).to be_a(Hash) }
51
- it('token value is in the result') { expect(results).to have_key(:token) }
52
- it('error_messages is empty') { expect(error_messages).to be_empty }
53
- end
61
+ it('results is a Hash') { expect(results).to be_a(Hash) }
62
+ it('token value is in the result') { expect(results).to have_key(:token) }
54
63
 
55
- context 'for valid credentials & path argument' do
56
- let(:create) { subject.create(credentials, 'operators/login') }
57
- let(:credentials) do
58
- {email: 'email@domain.com', password: 'valid_password'}
59
- end
60
-
61
- it('results is a Hash') { expect(results).to be_a(Hash) }
62
- it('token value is in the result') { expect(results).to have_key(:token) }
64
+ it('returns operator for operator path') do
65
+ expect(results).to have_key(:role)
66
+ end
63
67
 
64
- it('returns operator for operator path') do
65
- expect(results).to have_key(:role)
68
+ it('error_messages is empty') { expect(error_messages).to be_empty }
66
69
  end
67
-
68
- it('error_messages is empty') { expect(error_messages).to be_empty }
69
70
  end
70
- end
71
71
 
72
- describe '#destroy' do
73
- let(:destroy) { subject.destroy }
74
- let(:results) { destroy[0] }
75
- let(:error_messages) { destroy[1] }
72
+ describe '#destroy' do
73
+ let(:destroy) { subject.destroy }
74
+ let(:results) { destroy[0] }
75
+ let(:error_messages) { destroy[1] }
76
76
 
77
- it { expect { destroy }.not_to raise_error }
78
- it('results is nil') { expect(results).to be_nil }
79
- it('error_messages array is empty') { expect(error_messages).to eq([]) }
77
+ it { expect { destroy }.not_to raise_error }
78
+ it('results is nil') { expect(results).to be_nil }
79
+ it('error_messages array is empty') { expect(error_messages).to eq([]) }
80
+ end
80
81
  end
81
82
  end
@@ -10,15 +10,19 @@ RSpec.describe FinApps::REST::SignedDocumentsDownloads do
10
10
  let(:document) { described_class.new(api_client) }
11
11
 
12
12
  describe '#show' do
13
- context 'when missing parameters' do
14
- subject { document.show(:consumer_id, nil) }
13
+ context 'when missing signature request id' do
14
+ subject(:show) { document.show(:consumer_id, nil) }
15
15
 
16
16
  it 'raises an error when missing consumer id' do
17
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
17
+ expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
18
18
  end
19
+ end
20
+
21
+ context 'when missing consumer id' do
22
+ subject(:show) { document.show(nil, :signature_request_id) }
19
23
 
20
24
  it 'raises an error when missing signature request id' do
21
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
25
+ expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
22
26
  end
23
27
  end
24
28
 
@@ -11,10 +11,10 @@ RSpec.describe FinApps::REST::VerixDocuments do
11
11
 
12
12
  describe '#list' do
13
13
  context 'when missing parameters' do
14
- subject { document.list(nil) }
14
+ subject(:list) { document.list(nil) }
15
15
 
16
16
  it 'raises an error when missing record id' do
17
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
17
+ expect { list }.to raise_error(FinAppsCore::MissingArgumentsError)
18
18
  end
19
19
  end
20
20