finapps 5.0.3 → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +1 -7
  4. data/.tmuxinator.yml +19 -0
  5. data/Guardfile +42 -0
  6. data/finapps.gemspec +3 -1
  7. data/lib/finapps.rb +1 -7
  8. data/lib/finapps/rest/client.rb +5 -10
  9. data/lib/finapps/rest/consumers.rb +2 -1
  10. data/lib/finapps/rest/operators.rb +8 -2
  11. data/lib/finapps/rest/order_reports.rb +2 -1
  12. data/lib/finapps/rest/orders.rb +11 -9
  13. data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +15 -0
  14. data/lib/finapps/rest/portfolios_alerts.rb +2 -1
  15. data/lib/finapps/rest/portfolios_available_consumers.rb +2 -1
  16. data/lib/finapps/rest/portfolios_consumers.rb +6 -1
  17. data/lib/finapps/rest/products.rb +1 -2
  18. data/lib/finapps/rest/sessions.rb +8 -2
  19. data/lib/finapps/rest/statements.rb +2 -1
  20. data/lib/finapps/version.rb +1 -1
  21. data/spec/rest/alert_definitions_spec.rb +12 -7
  22. data/spec/rest/alert_occurrences_spec.rb +17 -5
  23. data/spec/rest/client_spec.rb +115 -57
  24. data/spec/rest/consumers_portfolios_spec.rb +9 -4
  25. data/spec/rest/consumers_spec.rb +76 -20
  26. data/spec/rest/operators_password_resets_spec.rb +19 -10
  27. data/spec/rest/operators_spec.rb +60 -22
  28. data/spec/rest/order_assignments_spec.rb +11 -5
  29. data/spec/rest/order_notifications_spec.rb +6 -2
  30. data/spec/rest/order_refreshes_spec.rb +11 -5
  31. data/spec/rest/order_reports_spec.rb +15 -5
  32. data/spec/rest/order_statuses_spec.rb +12 -4
  33. data/spec/rest/order_tokens_spec.rb +17 -5
  34. data/spec/rest/orders_spec.rb +80 -34
  35. data/spec/rest/password_resets_spec.rb +51 -14
  36. data/spec/rest/plaid/plaid_webhooks_spec.rb +7 -3
  37. data/spec/rest/portfolio_reports_spec.rb +9 -4
  38. data/spec/rest/portfolios_alerts_spec.rb +18 -10
  39. data/spec/rest/portfolios_available_consumers_spec.rb +9 -4
  40. data/spec/rest/portfolios_consumers_spec.rb +29 -11
  41. data/spec/rest/portfolios_spec.rb +51 -22
  42. data/spec/rest/products_spec.rb +5 -2
  43. data/spec/rest/sessions_spec.rb +36 -14
  44. data/spec/rest/statements_spec.rb +6 -2
  45. data/spec/rest/tenant_app_settings_spec.rb +13 -5
  46. data/spec/rest/tenant_settings_spec.rb +13 -5
  47. data/spec/rest/version_spec.rb +3 -1
  48. data/spec/spec_helper.rb +6 -4
  49. data/spec/spec_helpers/client.rb +2 -1
  50. data/spec/support/fake_api.rb +253 -119
  51. data/spec/utils/query_builder_spec.rb +8 -3
  52. data/tags +6 -0
  53. metadata +48 -25
  54. data/lib/finapps/rest/consumer_institution_refresh.rb +0 -14
  55. data/lib/finapps/rest/consumer_institution_refreshes.rb +0 -12
  56. data/lib/finapps/rest/institutions.rb +0 -34
  57. data/lib/finapps/rest/institutions_forms.rb +0 -14
  58. data/lib/finapps/rest/user_institutions.rb +0 -54
  59. data/lib/finapps/rest/user_institutions_forms.rb +0 -14
  60. data/lib/finapps/rest/user_institutions_statuses.rb +0 -19
  61. data/spec/rest/consumer_institution_refresh_spec.rb +0 -44
  62. data/spec/rest/consumer_institution_refreshes_spec.rb +0 -20
  63. data/spec/rest/institutions_forms_spec.rb +0 -29
  64. data/spec/rest/institutions_spec.rb +0 -55
  65. data/spec/rest/user_institutions_forms_spec.rb +0 -30
  66. data/spec/rest/user_institutions_spec.rb +0 -144
  67. data/spec/rest/user_institutions_statuses_spec.rb +0 -43
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helpers/client'
4
- RSpec.describe FinApps::REST::InstitutionsForms do
5
- include SpecHelpers::Client
6
-
7
- describe '#show' do
8
- context 'when missing site id' do
9
- subject { FinApps::REST::InstitutionsForms.new(client).show(nil) }
10
- it('raises missing argument error') { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
11
- end
12
-
13
- context 'when valid site id provided' do
14
- subject { FinApps::REST::InstitutionsForms.new(client).show('valid_site_id') }
15
-
16
- it { expect { subject }.not_to raise_error }
17
- it('performs a get and returns the login html') { expect(subject[0]).to respond_to(:login_form_html) }
18
- it('returns no error messages') { expect(subject[1]).to be_empty }
19
- end
20
-
21
- context 'when invalid site id provided' do
22
- subject { FinApps::REST::InstitutionsForms.new(client).show('invalid_site_id') }
23
-
24
- it { expect { subject }.not_to raise_error }
25
- it('results is nil') { expect(subject[0]).to be_nil }
26
- it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid institution id') }
27
- end
28
- end
29
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helpers/client'
4
- RSpec.describe FinApps::REST::Institutions do
5
- include SpecHelpers::Client
6
- subject(:institutions) { FinApps::REST::Institutions.new(client) }
7
-
8
- describe '#list' do
9
- context 'when search_term is missing' do
10
- let(:list) { subject.list(nil) }
11
- it { expect { list }.to raise_error(FinAppsCore::MissingArgumentsError) }
12
- end
13
-
14
- context 'when proper search_term is provided' do
15
- let(:list) { subject.list(:search_term) }
16
-
17
- it { expect { list }.not_to raise_error }
18
- it('returns an array') { expect(list).to be_a(Array) }
19
- it('performs a get and returns institution array') { expect(list[0]).to be_a(Array) }
20
- it('returns no error messages') { expect(list[1]).to be_empty }
21
- end
22
- end
23
-
24
- describe '#show' do
25
- context 'when id is missing' do
26
- it { expect { subject.show('') }.to raise_error(FinAppsCore::MissingArgumentsError) }
27
- end
28
-
29
- context 'when proper routing_number is provided' do
30
- # An ABA routing transit number (ABA RTN) is a nine digit code
31
- let(:show) { subject.show('999999999') }
32
-
33
- it { expect { show }.not_to raise_error }
34
- it('returns no error messages') { expect(show[ERROR_MESSAGES]).to be_empty }
35
- it('returns a hash on the results') { expect(show[RESULTS]).to be_a(Hash) }
36
- it('includes a base_url on the results') { expect(show[RESULTS]).to respond_to(:base_url) }
37
- it('includes a display_name on the results') { expect(show[RESULTS]).to respond_to(:display_name) }
38
- it('includes a site_id on the results') { expect(show[RESULTS]).to respond_to(:site_id) }
39
- it('includes a org_display_name on the results') { expect(show[RESULTS]).to respond_to(:org_display_name) }
40
- end
41
-
42
- context 'when proper site_id is provided' do
43
- # A site_id has less than 9 digits
44
- let(:show) { subject.show('5') }
45
-
46
- it { expect { show }.not_to raise_error }
47
- it('returns no error messages') { expect(show[ERROR_MESSAGES]).to be_empty }
48
- it('returns a hash on the results') { expect(show[RESULTS]).to be_a(Hash) }
49
- it('includes a base_url on the results') { expect(show[RESULTS]).to respond_to(:base_url) }
50
- it('includes a display_name on the results') { expect(show[RESULTS]).to respond_to(:display_name) }
51
- it('includes a site_id on the results') { expect(show[RESULTS]).to respond_to(:site_id) }
52
- it('includes a org_display_name on the results') { expect(show[RESULTS]).to respond_to(:org_display_name) }
53
- end
54
- end
55
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe FinApps::REST::UserInstitutionsForms do
4
- include SpecHelpers::Client
5
-
6
- describe '#show' do
7
- context 'when missing site id' do
8
- subject { FinApps::REST::UserInstitutionsForms.new(client).show(nil) }
9
- it('raises missing argument error') { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
10
- end
11
-
12
- context 'when valid site id provided' do
13
- subject { FinApps::REST::UserInstitutionsForms.new(client).show('valid_id') }
14
-
15
- it { expect { subject }.not_to raise_error }
16
- it('performs a get and returns the login html') { expect(subject[RESULTS]).to respond_to(:login_form_html) }
17
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
18
- end
19
-
20
- context 'when invalid site id provided' do
21
- subject { FinApps::REST::UserInstitutionsForms.new(client).show('invalid_id') }
22
-
23
- it { expect { subject }.not_to raise_error }
24
- it('results is nil') { expect(subject[RESULTS]).to be_nil }
25
- it('error messages array is populated') do
26
- expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid institution id')
27
- end
28
- end
29
- end
30
- end
@@ -1,144 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe FinApps::REST::UserInstitutions do
4
- include SpecHelpers::Client
5
-
6
- describe '#list' do
7
- context 'when successful' do
8
- subject { FinApps::REST::UserInstitutions.new(client).list }
9
-
10
- it('returns an array') { expect(subject).to be_a(Array) }
11
- it('performs a get and returns array of user institutions') { expect(subject[0]).to be_a(Array) }
12
- it('returns no error messages') { expect(subject[1]).to be_empty }
13
- end
14
- end
15
-
16
- describe '#create' do
17
- subject(:institutions) { FinApps::REST::UserInstitutions.new(client) }
18
-
19
- context 'when missing site_id' do
20
- let(:create) { subject.create(nil, :params) }
21
- it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
22
- end
23
-
24
- context 'when missing params' do
25
- let(:create) { subject.create(:site_id, nil) }
26
- it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
27
- end
28
-
29
- context 'when valid site_id and params are provided' do
30
- let(:create) { subject.create('valid_site_id', :params) }
31
-
32
- it { expect { create }.not_to raise_error }
33
- it('performs a post and returns the response') { expect(create[RESULTS]).to respond_to(:consumer_institution) }
34
- it('returns no error messages') { expect(create[ERROR_MESSAGES]).to be_empty }
35
- end
36
-
37
- # No tests for invalid site_id/params because of API/Yodlee flow
38
- end
39
-
40
- describe '#show' do
41
- context 'when missing id' do
42
- subject { FinApps::REST::UserInstitutions.new(client).show(nil) }
43
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
44
- end
45
-
46
- context 'when valid id is provided' do
47
- subject { FinApps::REST::UserInstitutions.new(client).show('valid_id') }
48
-
49
- it { expect { subject }.not_to raise_error }
50
- it('returns an array') { expect(subject).to be_a(Array) }
51
- it('performs a get and returns the response') { expect(subject[0]).to respond_to(:_id) }
52
- it('returns no error messages') { expect(subject[1]).to be_empty }
53
- end
54
-
55
- context 'when invalid id is provided' do
56
- subject { FinApps::REST::UserInstitutions.new(client).show('invalid_id') }
57
-
58
- it { expect { subject }.not_to raise_error }
59
- it('results is nil') { expect(subject[0]).to be_nil }
60
- it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
61
- end
62
- end
63
-
64
- describe '#mfa_update' do
65
- context 'when missing id' do
66
- subject { FinApps::REST::UserInstitutions.new(client).mfa_update(nil, :params) }
67
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
68
- end
69
-
70
- context 'when missing params' do
71
- subject { FinApps::REST::UserInstitutions.new(client).mfa_update(:id, nil) }
72
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
73
- end
74
-
75
- context 'when valid id and params are provided' do
76
- subject { FinApps::REST::UserInstitutions.new(client).mfa_update('valid_id', :params) }
77
-
78
- it { expect { subject }.not_to raise_error }
79
- it('performs a post and returns the response') { expect(subject[RESULTS]).to respond_to(:consumer_institution) }
80
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
81
- end
82
-
83
- context 'when invalid id is provided w/ params' do
84
- subject { FinApps::REST::UserInstitutions.new(client).mfa_update('invalid_id', :params) }
85
-
86
- it { expect { subject }.not_to raise_error }
87
- it('results is nil') { expect(subject[0]).to be_nil }
88
- it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
89
- end
90
- end
91
-
92
- describe '#credentials_update' do
93
- context 'when missing id' do
94
- subject { FinApps::REST::UserInstitutions.new(client).credentials_update(nil, :params) }
95
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
96
- end
97
-
98
- context 'when missing params' do
99
- subject { FinApps::REST::UserInstitutions.new(client).credentials_update(:id, nil) }
100
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
101
- end
102
-
103
- context 'when valid id and params are provided' do
104
- subject { FinApps::REST::UserInstitutions.new(client).credentials_update('valid_id', :params) }
105
-
106
- it { expect { subject }.not_to raise_error }
107
- it('performs a post and returns the response') { expect(subject[RESULTS]).to respond_to(:consumer_institution) }
108
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
109
- end
110
-
111
- context 'when invalid id is provided w/ params' do
112
- subject { FinApps::REST::UserInstitutions.new(client).credentials_update('invalid_id', :params) }
113
-
114
- it { expect { subject }.not_to raise_error }
115
- it('results is nil') { expect(subject[0]).to be_nil }
116
- it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
117
- end
118
- end
119
-
120
- describe '#destroy' do
121
- context 'when missing id' do
122
- subject { FinApps::REST::UserInstitutions.new(client).destroy(nil) }
123
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
124
- end
125
-
126
- context 'when valid id is provided' do
127
- subject { FinApps::REST::UserInstitutions.new(client).destroy('valid_id') }
128
-
129
- it { expect { subject }.not_to raise_error }
130
- it('returns an array') { expect(subject).to be_a(Array) }
131
- it('performs a delete and returns empty response') { expect(subject[0]).to be_nil }
132
- it('returns no error messages') { expect(subject[1]).to be_empty }
133
- end
134
-
135
- context 'when invalid id is provided' do
136
- subject { FinApps::REST::UserInstitutions.new(client).destroy('invalid_id') }
137
-
138
- it { expect { subject }.not_to raise_error }
139
- it('returns an array') { expect(subject).to be_a(Array) }
140
- it('results is nil') { expect(subject[0]).to be_nil }
141
- it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
142
- end
143
- end
144
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helpers/client'
4
-
5
- RSpec.describe FinApps::REST::UserInstitutionsStatuses do
6
- include SpecHelpers::Client
7
-
8
- describe '#show' do
9
- context 'when missing id' do
10
- subject { FinApps::REST::UserInstitutionsStatuses.new(client).show(nil) }
11
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
12
- end
13
-
14
- context 'when valid id is provided' do
15
- subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('valid_id') }
16
-
17
- it { expect { subject }.not_to raise_error }
18
- it('returns an array') { expect(subject).to be_a(Array) }
19
- it('performs a get and returns the response') { expect(subject[RESULTS]).to respond_to(:_id) }
20
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
21
- end
22
-
23
- context 'when invalid id is provided' do
24
- subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('invalid_id') }
25
-
26
- it { expect { subject }.not_to raise_error }
27
- it('results is nil') { expect(subject[RESULTS]).to be_nil }
28
- it('error messages array is populated') do
29
- expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid user institution id')
30
- end
31
- end
32
- end
33
-
34
- describe '#update' do
35
- context 'when successful' do
36
- subject { FinApps::REST::UserInstitutionsStatuses.new(client).update }
37
-
38
- it('returns an array') { expect(subject).to be_a(Array) }
39
- it('performs a get and returns array of user institutions statuses') { expect(subject[RESULTS]).to be_a(Array) }
40
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
41
- end
42
- end
43
- end