finapps 5.0.30 → 5.0.35
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.
- checksums.yaml +4 -4
- data/.github/workflows/main.yaml +37 -0
- data/.rubocop.yml +134 -61
- data/.rubocop_todo.yml +29 -0
- data/.tmuxinator.yml +1 -0
- data/.travis.yml +3 -1
- data/README.md +1 -0
- data/RELEASES.md +29 -0
- data/finapps.gemspec +4 -4
- data/lib/finapps/rest/alert_definitions.rb +1 -1
- data/lib/finapps/rest/alert_occurrences.rb +1 -1
- data/lib/finapps/rest/client.rb +6 -5
- data/lib/finapps/rest/consumers.rb +22 -6
- data/lib/finapps/rest/consumers_portfolios.rb +1 -1
- data/lib/finapps/rest/documents_orders.rb +43 -26
- data/lib/finapps/rest/operators.rb +5 -5
- data/lib/finapps/rest/operators_password_resets.rb +1 -1
- data/lib/finapps/rest/order_assignments.rb +1 -1
- data/lib/finapps/rest/order_reports.rb +1 -1
- data/lib/finapps/rest/orders.rb +33 -22
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
- data/lib/finapps/rest/portfolio_reports.rb +1 -1
- data/lib/finapps/rest/portfolios.rb +1 -1
- data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
- data/lib/finapps/rest/portfolios_consumers.rb +1 -1
- data/lib/finapps/rest/sessions.rb +11 -9
- data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
- data/lib/finapps/utils/query_builder.rb +13 -4
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +10 -6
- data/spec/rest/alert_occurrences_spec.rb +6 -1
- data/spec/rest/api_request.rb +1 -0
- data/spec/rest/client_spec.rb +33 -41
- data/spec/rest/consumers_portfolios_spec.rb +7 -2
- data/spec/rest/consumers_spec.rb +240 -192
- data/spec/rest/documents_orders_notifications_spec.rb +4 -2
- data/spec/rest/documents_orders_spec.rb +94 -17
- data/spec/rest/esign_templates_spec.rb +2 -1
- data/spec/rest/operators_password_resets_spec.rb +50 -52
- data/spec/rest/operators_spec.rb +181 -172
- data/spec/rest/order_assignments_spec.rb +6 -1
- data/spec/rest/order_notifications_spec.rb +4 -2
- data/spec/rest/order_refreshes_spec.rb +8 -5
- data/spec/rest/order_reports_spec.rb +21 -15
- data/spec/rest/order_statuses_spec.rb +14 -10
- data/spec/rest/order_tokens_spec.rb +37 -30
- data/spec/rest/orders_spec.rb +121 -73
- data/spec/rest/password_resets_spec.rb +46 -36
- data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
- data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +11 -11
- data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
- data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
- data/spec/rest/portfolio_reports_spec.rb +7 -2
- data/spec/rest/portfolios_alerts_spec.rb +9 -4
- data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
- data/spec/rest/portfolios_consumers_spec.rb +15 -4
- data/spec/rest/portfolios_spec.rb +20 -17
- data/spec/rest/products_spec.rb +17 -14
- data/spec/rest/sessions_spec.rb +63 -58
- data/spec/rest/signed_documents_downloads_spec.rb +10 -6
- data/spec/rest/tenant_app_settings_spec.rb +9 -3
- data/spec/rest/tenant_settings_spec.rb +9 -3
- data/spec/rest/verix/verix_documents_spec.rb +15 -22
- data/spec/rest/verix/verix_metadata_spec.rb +1 -1
- data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
- data/spec/rest/verix/verix_records_spec.rb +31 -10
- data/spec/rest/version_spec.rb +6 -4
- data/spec/spec_helper.rb +2 -2
- data/spec/support/fake_api.rb +9 -3
- data/spec/support/fixtures/documents_orders_none.json +6 -0
- data/spec/utils/query_builder_spec.rb +40 -14
- metadata +20 -17
@@ -6,10 +6,11 @@ RSpec.describe FinApps::REST::OrderNotifications do
|
|
6
6
|
include SpecHelpers::Client
|
7
7
|
|
8
8
|
describe '#update' do
|
9
|
-
subject(:orders) {
|
9
|
+
subject(:orders) { described_class.new(client) }
|
10
10
|
|
11
11
|
context 'when missing id' do
|
12
12
|
let(:update) { subject.update(nil) }
|
13
|
+
|
13
14
|
it('returns missing argument error') do
|
14
15
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
15
16
|
end
|
@@ -22,12 +23,13 @@ RSpec.describe FinApps::REST::OrderNotifications do
|
|
22
23
|
|
23
24
|
it { expect { update }.not_to raise_error }
|
24
25
|
it('results is nil') { expect(results).to be_nil }
|
26
|
+
|
25
27
|
it('error messages array is populated') do
|
26
28
|
expect(error_messages.first.downcase).to eq('resource not found')
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
context '
|
32
|
+
context 'with valid id' do
|
31
33
|
let(:update) { subject.update(:valid_id) }
|
32
34
|
let(:results) { update[RESULTS] }
|
33
35
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
@@ -4,11 +4,12 @@ require 'spec_helpers/client'
|
|
4
4
|
|
5
5
|
RSpec.describe FinApps::REST::OrderRefreshes do
|
6
6
|
include SpecHelpers::Client
|
7
|
-
subject {
|
7
|
+
subject { described_class.new(client) }
|
8
8
|
|
9
9
|
describe '#create' do
|
10
10
|
context 'when missing id' do
|
11
11
|
let(:create) { subject.create(nil) }
|
12
|
+
|
12
13
|
it do
|
13
14
|
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
14
15
|
end
|
@@ -16,12 +17,12 @@ RSpec.describe FinApps::REST::OrderRefreshes do
|
|
16
17
|
|
17
18
|
context 'when valid id is provided' do
|
18
19
|
let(:create) { subject.create(:valid_id) }
|
20
|
+
|
19
21
|
it { expect { create }.not_to raise_error }
|
20
22
|
it('returns an array') { expect(create).to be_a(Array) }
|
21
|
-
it
|
22
|
-
|
23
|
-
|
24
|
-
end
|
23
|
+
it { expect(create[RESULTS]).to have_key(:public_id) }
|
24
|
+
it { expect(create[RESULTS]).to have_key(:original_order_id) }
|
25
|
+
|
25
26
|
it('returns no error messages') do
|
26
27
|
expect(create[ERROR_MESSAGES]).to be_empty
|
27
28
|
end
|
@@ -29,9 +30,11 @@ RSpec.describe FinApps::REST::OrderRefreshes do
|
|
29
30
|
|
30
31
|
context 'when invalid id is provided' do
|
31
32
|
let(:create) { subject.create(:invalid_id) }
|
33
|
+
|
32
34
|
it { expect { create }.not_to raise_error }
|
33
35
|
it('returns an array') { expect(create).to be_a(Array) }
|
34
36
|
it('results is nil') { expect(create[RESULTS]).to be_nil }
|
37
|
+
|
35
38
|
it('error messages array is populated') do
|
36
39
|
expect(create[ERROR_MESSAGES].first.downcase).to eq(
|
37
40
|
'resource not found'
|
@@ -5,47 +5,53 @@ require 'spec_helpers/client'
|
|
5
5
|
RSpec.describe FinApps::REST::OrderReports do
|
6
6
|
include SpecHelpers::Client
|
7
7
|
|
8
|
-
let(:order_report) {
|
8
|
+
let(:order_report) { described_class.new client }
|
9
9
|
|
10
10
|
describe '#show' do
|
11
11
|
context 'when missing id' do
|
12
|
-
subject { order_report.show(nil, :pdf) }
|
12
|
+
subject(:show) { order_report.show(nil, :pdf) }
|
13
|
+
|
13
14
|
it do
|
14
|
-
expect {
|
15
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
19
|
context 'when missing format' do
|
19
|
-
subject { order_report.show(:valid_id, nil) }
|
20
|
+
subject(:show) { order_report.show(:valid_id, nil) }
|
21
|
+
|
20
22
|
it do
|
21
|
-
expect {
|
23
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
27
|
context 'when invalid format is provided' do
|
26
|
-
subject { order_report.show(:valid_id, :xml) }
|
28
|
+
subject(:show) { order_report.show(:valid_id, :xml) }
|
29
|
+
|
27
30
|
it do
|
28
|
-
expect {
|
31
|
+
expect { show }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
35
|
context 'when valid params are provided' do
|
33
|
-
subject { order_report.show(:valid_id, :json) }
|
36
|
+
subject(:show) { order_report.show(:valid_id, :json) }
|
37
|
+
|
38
|
+
it { expect { show }.not_to raise_error }
|
34
39
|
|
35
|
-
it { expect { subject }.not_to raise_error }
|
36
40
|
it('performs a get and returns the response') do
|
37
|
-
expect(
|
41
|
+
expect(show[0]).to have_key(:days_requested)
|
38
42
|
end
|
39
|
-
|
43
|
+
|
44
|
+
it('returns no error messages') { expect(show[1]).to be_empty }
|
40
45
|
end
|
41
46
|
|
42
47
|
context 'when invalid id is provided' do
|
43
|
-
subject { order_report.show(:invalid_id, :json) }
|
48
|
+
subject(:show) { order_report.show(:invalid_id, :json) }
|
49
|
+
|
50
|
+
it { expect { show }.not_to raise_error }
|
51
|
+
it('results is nil') { expect(show[0]).to be_nil }
|
44
52
|
|
45
|
-
it { expect { subject }.not_to raise_error }
|
46
|
-
it('results is nil') { expect(subject[0]).to be_nil }
|
47
53
|
it('error messages array is populated') do
|
48
|
-
expect(
|
54
|
+
expect(show[1].first.downcase).to eq('resource not found')
|
49
55
|
end
|
50
56
|
end
|
51
57
|
end
|
@@ -5,31 +5,35 @@ RSpec.describe FinApps::REST::OrderStatuses do
|
|
5
5
|
|
6
6
|
describe '#show' do
|
7
7
|
context 'when missing id' do
|
8
|
-
subject {
|
8
|
+
subject(:show) { described_class.new(client).show(nil) }
|
9
|
+
|
9
10
|
it do
|
10
|
-
expect {
|
11
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
15
|
context 'when valid id is provided' do
|
15
|
-
subject {
|
16
|
+
subject(:show) { described_class.new(client).show(:valid_id) }
|
17
|
+
|
18
|
+
it { expect { show }.not_to raise_error }
|
16
19
|
|
17
|
-
it { expect { subject }.not_to raise_error }
|
18
20
|
it('performs a get and returns the response') do
|
19
|
-
expect(
|
21
|
+
expect(show[RESULTS]).to have_key(:status)
|
20
22
|
end
|
23
|
+
|
21
24
|
it('returns no error messages') do
|
22
|
-
expect(
|
25
|
+
expect(show[ERROR_MESSAGES]).to be_empty
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
29
|
context 'when invalid id is provided' do
|
27
|
-
subject {
|
30
|
+
subject(:show) { described_class.new(client).show(:invalid_id) }
|
31
|
+
|
32
|
+
it { expect { show }.not_to raise_error }
|
33
|
+
it('results is nil') { expect(show[RESULTS]).to be_nil }
|
28
34
|
|
29
|
-
it { expect { subject }.not_to raise_error }
|
30
|
-
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
31
35
|
it('error messages array is populated') do
|
32
|
-
expect(
|
36
|
+
expect(show[ERROR_MESSAGES].first.downcase).to eq(
|
33
37
|
'resource not found'
|
34
38
|
)
|
35
39
|
end
|
@@ -2,40 +2,47 @@
|
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
4
|
|
5
|
-
RSpec.describe FinApps::REST::OrderTokens
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
RSpec.describe FinApps::REST::OrderTokens do
|
6
|
+
context 'when initialized with valid FinApps::Client object' do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
|
9
|
+
describe '#show' do
|
10
|
+
subject(:order_tokens) { described_class.new(client) }
|
11
|
+
|
12
|
+
let(:results) { show[RESULTS] }
|
13
|
+
let(:error_messages) { show[ERROR_MESSAGES] }
|
14
|
+
|
15
|
+
context 'when missing token' do
|
16
|
+
it do
|
17
|
+
expect { order_tokens.show(nil) }.to raise_error(
|
18
|
+
FinAppsCore::MissingArgumentsError,
|
19
|
+
': token'
|
20
|
+
)
|
21
|
+
end
|
20
22
|
end
|
21
|
-
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
context 'with valid token' do
|
25
|
+
let(:show) { subject.show(:valid_token) }
|
26
|
+
|
27
|
+
it { expect { show }.not_to raise_error }
|
28
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
29
|
+
|
30
|
+
it('results contains a consumer_id') do
|
31
|
+
expect(results).to have_key(:consumer_id)
|
32
|
+
end
|
33
|
+
|
34
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
29
35
|
end
|
30
|
-
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
31
|
-
end
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
context 'with invalid token' do
|
38
|
+
let(:show) { subject.show(:invalid_token) }
|
39
|
+
|
40
|
+
it { expect { show }.not_to raise_error }
|
41
|
+
it('results is nil') { expect(results).to be_nil }
|
42
|
+
|
43
|
+
it('error messages array is populated') do
|
44
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
45
|
+
end
|
39
46
|
end
|
40
47
|
end
|
41
48
|
end
|
data/spec/rest/orders_spec.rb
CHANGED
@@ -7,60 +7,63 @@ RSpec.describe FinApps::REST::Orders do
|
|
7
7
|
|
8
8
|
describe '#show' do
|
9
9
|
context 'when missing params' do
|
10
|
-
subject {
|
10
|
+
subject(:show) { described_class.new(client).show(nil) }
|
11
|
+
|
11
12
|
it do
|
12
|
-
expect {
|
13
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
context 'when valid params are provided' do
|
17
|
-
subject {
|
18
|
+
subject(:show) { described_class.new(client).show(:valid_id) }
|
19
|
+
|
20
|
+
it { expect { show }.not_to raise_error }
|
21
|
+
it('returns an array') { expect(show).to be_a(Array) }
|
22
|
+
it { expect(show[RESULTS]).to have_key(:public_id) }
|
23
|
+
it { expect(show[RESULTS]).to have_key(:consumer_id) }
|
18
24
|
|
19
|
-
it { expect { subject }.not_to raise_error }
|
20
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
21
|
-
it('performs a get and returns the response') do
|
22
|
-
expect(subject[RESULTS]).to have_key(:public_id)
|
23
|
-
expect(subject[RESULTS]).to have_key(:consumer_id)
|
24
|
-
end
|
25
25
|
it('returns no error messages') do
|
26
|
-
expect(
|
26
|
+
expect(show[ERROR_MESSAGES]).to be_empty
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#create' do
|
32
32
|
context 'when missing params' do
|
33
|
-
subject {
|
33
|
+
subject(:create) { described_class.new(client).create(nil) }
|
34
|
+
|
34
35
|
it do
|
35
|
-
expect {
|
36
|
+
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
40
|
context 'when valid params are provided' do
|
40
|
-
subject {
|
41
|
+
subject(:create) { described_class.new(client).create(valid_params) }
|
42
|
+
|
41
43
|
let(:valid_params) do
|
42
|
-
{
|
44
|
+
{applicant: 'valid', institutions: 'valid', product: 'valid'}
|
43
45
|
end
|
44
46
|
|
45
|
-
it { expect {
|
46
|
-
it('returns an array') { expect(
|
47
|
-
it
|
48
|
-
|
49
|
-
|
50
|
-
end
|
47
|
+
it { expect { create }.not_to raise_error }
|
48
|
+
it('returns an array') { expect(create).to be_a(Array) }
|
49
|
+
it { expect(create[RESULTS]).to have_key(:public_id) }
|
50
|
+
it { expect(create[RESULTS]).to have_key(:consumer_id) }
|
51
|
+
|
51
52
|
it('returns no error messages') do
|
52
|
-
expect(
|
53
|
+
expect(create[ERROR_MESSAGES]).to be_empty
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
context 'when invalid params are provided' do
|
57
|
-
subject {
|
58
|
-
|
58
|
+
subject(:create) { described_class.new(client).create(invalid_params) }
|
59
|
+
|
60
|
+
let(:invalid_params) { {applicant: 'valid'} }
|
61
|
+
|
62
|
+
it { expect { create }.not_to raise_error }
|
63
|
+
it('results is nil') { expect(create[RESULTS]).to be_nil }
|
59
64
|
|
60
|
-
it { expect { subject }.not_to raise_error }
|
61
|
-
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
62
65
|
it('error messages array is populated') do
|
63
|
-
expect(
|
66
|
+
expect(create[ERROR_MESSAGES].first.downcase).to eq(
|
64
67
|
'invalid request body'
|
65
68
|
)
|
66
69
|
end
|
@@ -71,29 +74,34 @@ RSpec.describe FinApps::REST::Orders do
|
|
71
74
|
context 'when missing params' do
|
72
75
|
# use defaults
|
73
76
|
|
74
|
-
subject {
|
75
|
-
|
77
|
+
subject(:list) { described_class.new(client).list }
|
78
|
+
|
79
|
+
it { expect { list }.not_to raise_error }
|
80
|
+
|
81
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
76
82
|
|
77
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
78
83
|
it('performs a get and returns the response') do
|
79
|
-
expect(
|
84
|
+
expect(list[RESULTS]).to have_key(:orders)
|
80
85
|
end
|
86
|
+
|
81
87
|
it('returns no error messages') do
|
82
|
-
expect(
|
88
|
+
expect(list[ERROR_MESSAGES]).to be_empty
|
83
89
|
end
|
84
90
|
end
|
85
91
|
|
86
92
|
context 'when invalid params are provided' do
|
87
|
-
subject {
|
93
|
+
subject(:list) { described_class.new(client).list(invalid_params) }
|
94
|
+
|
88
95
|
let(:invalid_params) { %w[this is an array] }
|
89
96
|
|
90
97
|
it do
|
91
|
-
expect {
|
98
|
+
expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
95
102
|
context 'when including valid params' do
|
96
|
-
subject {
|
103
|
+
subject(:list) { described_class.new(client).list(params) }
|
104
|
+
|
97
105
|
let(:params) do
|
98
106
|
{
|
99
107
|
page: 2,
|
@@ -107,61 +115,88 @@ RSpec.describe FinApps::REST::Orders do
|
|
107
115
|
}
|
108
116
|
end
|
109
117
|
|
110
|
-
it { expect {
|
111
|
-
it('returns an array') { expect(
|
118
|
+
it { expect { list }.not_to raise_error }
|
119
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
120
|
+
|
112
121
|
it('performs a get and returns the response') do
|
113
|
-
expect(
|
122
|
+
expect(list[RESULTS]).to have_key(:orders)
|
114
123
|
end
|
124
|
+
|
115
125
|
it('each order contains a consumer_id') do
|
116
|
-
expect(
|
126
|
+
expect(list[RESULTS][:orders]).to all(have_key(:consumer_id))
|
117
127
|
end
|
128
|
+
|
118
129
|
it('returns no error messages') do
|
119
|
-
expect(
|
130
|
+
expect(list[ERROR_MESSAGES]).to be_empty
|
120
131
|
end
|
132
|
+
|
121
133
|
it 'builds query and sends proper request' do
|
122
|
-
|
123
|
-
url =
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
134
|
+
list
|
135
|
+
url = "#{versioned_api_path}/orders?"\
|
136
|
+
'filter=%7B%22$or%22:%5B%7B%22public_id%22:%7B%22$regex%22:%22%5E'\
|
137
|
+
'term%22,%22$options%22:%22i%22%7D%7D,%7B%22assignment.last_name%22:%22'\
|
138
|
+
'term%22%7D,%7B%22applicant.first_name%22:%22term%22%7D,%7B%22'\
|
139
|
+
'applicant.last_name%22:%22term%22%7D,%7B%22requestor.reference_no'\
|
140
|
+
'%22:%7B%22$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D%5D,%22'\
|
141
|
+
'status%22:%7B%22$in%22:%5B1,7%5D%7D,%22assignment.operator_id%22:%22'\
|
142
|
+
'valid_operator%22,%22consumer_id%22:%22valid_consumer_id%22%7D&page=2&requested=25&sort=status'
|
130
143
|
expect(WebMock).to have_requested(:get, url)
|
131
144
|
end
|
145
|
+
|
132
146
|
it 'builds query and sends proper request with searchTerm/relation exclusivity' do
|
133
147
|
params[:searchTerm] = nil
|
134
|
-
|
135
|
-
url =
|
136
|
-
|
137
|
-
'%22assignment.operator_id%22:%22valid_operator%22
|
138
|
-
'%
|
139
|
-
'%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D
|
148
|
+
list
|
149
|
+
url = "#{versioned_api_path}/orders?"\
|
150
|
+
'filter=%7B%22status%22:%7B%22$in%22:%5B1,7%5D%7D,' \
|
151
|
+
'%22assignment.operator_id%22:%22valid_operator%22,'\
|
152
|
+
'%22consumer_id%22:%22valid_consumer_id%22,' \
|
153
|
+
'%22$or%22:%5B%7B%22public_id%22:%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D,'\
|
154
|
+
'%7B%22original_order_id%22:%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D%5D%7D&'\
|
155
|
+
'page=2&requested=25&sort=status'
|
156
|
+
expect(WebMock).to have_requested(:get, url)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'handles space in search term for consumer' do
|
160
|
+
params[:searchTerm] = 'Spacing Out'
|
161
|
+
list
|
162
|
+
url = "#{versioned_api_path}/orders?"\
|
163
|
+
'filter=%7B%22$or%22:%5B%7B%22public_id%22:%7B%22$regex%22:%22%5E'\
|
164
|
+
'Spacing%20Out%22,%22$options%22:%22i%22%7D%7D,%7B%22assignment.last_name'\
|
165
|
+
'%22:%22Spacing%20Out%22%7D,%7B%22applicant.first_name%22:%22'\
|
166
|
+
'Spacing%20Out%22%7D,%7B%22applicant.last_name%22:%22Spacing%20Out'\
|
167
|
+
'%22%7D,%7B%22requestor.reference_no%22:%7B%22$regex%22:%22%5ESpacing%20Out'\
|
168
|
+
'%22,%22$options%22:%22i%22%7D%7D,%7B%22applicant.first_name%22:%22Spacing'\
|
169
|
+
'%22%7D,%7B%22applicant.last_name%22:%22Spacing%22%7D,%7B%22applicant.first_name'\
|
170
|
+
'%22:%22Out%22%7D,%7B%22applicant.last_name%22:%22Out%22%7D%5D,%22status'\
|
171
|
+
'%22:%7B%22$in%22:%5B1,7%5D%7D,%22assignment.operator_id%22:%22valid_operator'\
|
172
|
+
'%22,%22consumer_id%22:%22valid_consumer_id%22%7D&page=2&requested=25&sort=status'
|
140
173
|
expect(WebMock).to have_requested(:get, url)
|
141
174
|
end
|
175
|
+
|
142
176
|
it 'builds null assignment query properly when supplied w/ empty string' do
|
143
|
-
|
177
|
+
described_class.new(client).list(assignment: '')
|
144
178
|
|
145
|
-
url =
|
146
|
-
|
179
|
+
url = "#{versioned_api_path}/orders?"\
|
180
|
+
'filter=%7B%22assignment.operator_id%22:null%7D'
|
147
181
|
expect(WebMock).to have_requested(:get, url)
|
148
182
|
end
|
149
183
|
end
|
150
184
|
end
|
151
185
|
|
152
186
|
describe '#update' do
|
153
|
-
subject(:orders) {
|
187
|
+
subject(:orders) { described_class.new(client) }
|
154
188
|
|
155
189
|
context 'with nil params' do
|
156
190
|
context 'when missing id' do
|
157
|
-
let(:update) {
|
191
|
+
let(:update) { orders.update(nil) }
|
192
|
+
|
158
193
|
it('returns missing argument error') do
|
159
194
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
160
195
|
end
|
161
196
|
end
|
162
197
|
|
163
198
|
context 'when valid id is provided' do
|
164
|
-
let(:update) {
|
199
|
+
let(:update) { orders.update('valid_id') } # how to stub params
|
165
200
|
let(:results) { update[RESULTS] }
|
166
201
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
167
202
|
|
@@ -171,12 +206,13 @@ RSpec.describe FinApps::REST::Orders do
|
|
171
206
|
end
|
172
207
|
|
173
208
|
context 'when invalid id is provided' do
|
174
|
-
let(:update) {
|
209
|
+
let(:update) { orders.update('invalid_id') }
|
175
210
|
let(:results) { update[RESULTS] }
|
176
211
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
177
212
|
|
178
213
|
it { expect { update }.not_to raise_error }
|
179
214
|
it('results is nil') { expect(results).to be_nil }
|
215
|
+
|
180
216
|
it('error messages array is populated') do
|
181
217
|
expect(error_messages.first.downcase).to eq('resource not found')
|
182
218
|
end
|
@@ -185,14 +221,15 @@ RSpec.describe FinApps::REST::Orders do
|
|
185
221
|
|
186
222
|
context 'with params' do
|
187
223
|
context 'when missing id' do
|
188
|
-
let(:update) {
|
224
|
+
let(:update) { orders.update(nil, params: 'valid') }
|
225
|
+
|
189
226
|
it('does not raise error') do
|
190
227
|
expect { update }.not_to raise_error
|
191
228
|
end
|
192
229
|
end
|
193
230
|
|
194
231
|
context 'when valid params are provided' do
|
195
|
-
let(:update) {
|
232
|
+
let(:update) { orders.update(nil, params: 'valid') }
|
196
233
|
let(:results) { update[RESULTS] }
|
197
234
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
198
235
|
|
@@ -202,12 +239,13 @@ RSpec.describe FinApps::REST::Orders do
|
|
202
239
|
end
|
203
240
|
|
204
241
|
context 'when invalid params are provided' do
|
205
|
-
let(:update) {
|
242
|
+
let(:update) { orders.update(nil, params: 'invalid') }
|
206
243
|
let(:results) { update[RESULTS] }
|
207
244
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
208
245
|
|
209
246
|
it { expect { update }.not_to raise_error }
|
210
247
|
it('results is nil') { expect(results).to be_nil }
|
248
|
+
|
211
249
|
it('error messages array is populated') do
|
212
250
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
213
251
|
end
|
@@ -215,39 +253,49 @@ RSpec.describe FinApps::REST::Orders do
|
|
215
253
|
end
|
216
254
|
end
|
217
255
|
|
256
|
+
# Test it calls update while making rubocop happy
|
218
257
|
describe '#create_and_submit' do
|
219
|
-
subject(:orders) {
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
258
|
+
subject(:orders) { described_class.new(client) }
|
259
|
+
|
260
|
+
let(:create_submit) { orders.create_and_submit(params) }
|
261
|
+
let(:params) { {params: 'valid'} }
|
262
|
+
let(:results) { create_submit[RESULTS] }
|
263
|
+
let(:error_messages) { create_submit[ERROR_MESSAGES] }
|
264
|
+
|
265
|
+
it { expect { create_submit }.not_to raise_error }
|
266
|
+
it('results is nil') { expect(results).to be_nil }
|
267
|
+
|
268
|
+
it('error messages array is empty') do
|
269
|
+
expect(error_messages).to eq([])
|
224
270
|
end
|
225
271
|
end
|
226
272
|
|
227
273
|
describe '#destroy' do
|
228
|
-
subject(:orders) {
|
274
|
+
subject(:orders) { described_class.new(client) }
|
229
275
|
|
230
276
|
context 'when missing id' do
|
231
|
-
let(:destroy) {
|
277
|
+
let(:destroy) { orders.destroy(nil) }
|
278
|
+
|
232
279
|
it('returns missing argument error') do
|
233
280
|
expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError)
|
234
281
|
end
|
235
282
|
end
|
236
283
|
|
237
284
|
context 'when invalid id is provided' do
|
238
|
-
let(:destroy) {
|
285
|
+
let(:destroy) { orders.destroy(:invalid_id) }
|
239
286
|
let(:results) { destroy[RESULTS] }
|
240
287
|
let(:error_messages) { destroy[ERROR_MESSAGES] }
|
241
288
|
|
242
289
|
it { expect { destroy }.not_to raise_error }
|
243
290
|
it('results is nil') { expect(results).to be_nil }
|
291
|
+
|
244
292
|
it('error messages array is populated') do
|
245
293
|
expect(error_messages.first.downcase).to eq('resource not found')
|
246
294
|
end
|
247
295
|
end
|
248
296
|
|
249
|
-
context '
|
250
|
-
let(:destroy) {
|
297
|
+
context 'with valid id' do
|
298
|
+
let(:destroy) { orders.destroy(:valid_id) }
|
251
299
|
let(:results) { destroy[RESULTS] }
|
252
300
|
let(:error_messages) { destroy[ERROR_MESSAGES] }
|
253
301
|
|