finapps 5.0.32 → 5.0.33
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/.rubocop.yml +134 -61
- data/.rubocop_todo.yml +120 -0
- data/.tmuxinator.yml +1 -0
- data/.travis.yml +3 -1
- data/finapps.gemspec +3 -3
- data/lib/finapps/rest/alert_definitions.rb +1 -1
- data/lib/finapps/rest/alert_occurrences.rb +1 -1
- data/lib/finapps/rest/consumers.rb +5 -5
- data/lib/finapps/rest/consumers_portfolios.rb +1 -1
- data/lib/finapps/rest/documents_orders.rb +25 -24
- 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 +10 -10
- 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 +1 -1
- data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +10 -2
- data/spec/rest/alert_occurrences_spec.rb +6 -1
- data/spec/rest/api_request.rb +1 -0
- data/spec/rest/client_spec.rb +2 -2
- data/spec/rest/consumers_portfolios_spec.rb +7 -2
- data/spec/rest/consumers_spec.rb +39 -11
- data/spec/rest/documents_orders_notifications_spec.rb +3 -1
- data/spec/rest/documents_orders_spec.rb +85 -23
- data/spec/rest/esign_templates_spec.rb +2 -1
- data/spec/rest/operators_password_resets_spec.rb +6 -1
- data/spec/rest/operators_spec.rb +22 -2
- data/spec/rest/order_assignments_spec.rb +6 -1
- data/spec/rest/order_notifications_spec.rb +3 -1
- data/spec/rest/order_refreshes_spec.rb +7 -1
- data/spec/rest/order_reports_spec.rb +7 -1
- data/spec/rest/order_statuses_spec.rb +7 -3
- data/spec/rest/order_tokens_spec.rb +7 -1
- data/spec/rest/orders_spec.rb +63 -29
- data/spec/rest/password_resets_spec.rb +20 -10
- 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 +10 -10
- 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 +6 -1
- data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
- data/spec/rest/portfolios_consumers_spec.rb +13 -2
- data/spec/rest/portfolios_spec.rb +20 -5
- data/spec/rest/products_spec.rb +3 -1
- data/spec/rest/sessions_spec.rb +8 -4
- data/spec/rest/signed_documents_downloads_spec.rb +3 -3
- 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 +13 -20
- 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 +3 -1
- 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 +17 -15
|
@@ -9,7 +9,7 @@ module FinApps
|
|
|
9
9
|
|
|
10
10
|
def list(params = nil)
|
|
11
11
|
return super if params.nil?
|
|
12
|
-
|
|
12
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
|
13
13
|
|
|
14
14
|
super build_query_path(end_point, params)
|
|
15
15
|
end
|
|
@@ -36,7 +36,7 @@ module FinApps
|
|
|
36
36
|
def update_password(params)
|
|
37
37
|
# update password for current operator, need authorization session in header
|
|
38
38
|
not_blank(params, :params)
|
|
39
|
-
|
|
39
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
|
|
40
40
|
|
|
41
41
|
path = "#{end_point}/password/change"
|
|
42
42
|
|
|
@@ -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
|
|
@@ -22,7 +22,7 @@ module FinApps
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
24
|
def validates_email(params)
|
|
25
|
-
|
|
25
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless email_exists? params
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def email_exists?(params)
|
|
@@ -6,7 +6,7 @@ module FinApps
|
|
|
6
6
|
def update(id, orders_array)
|
|
7
7
|
not_blank(id, :operator_id)
|
|
8
8
|
not_blank(orders_array, :params)
|
|
9
|
-
|
|
9
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless orders_array.is_a? Array
|
|
10
10
|
|
|
11
11
|
path = "operators/#{ERB::Util.url_encode(id)}/assign"
|
|
12
12
|
super orders_array, path
|
|
@@ -6,7 +6,7 @@ module FinApps
|
|
|
6
6
|
def show(id, format)
|
|
7
7
|
not_blank(id, :id)
|
|
8
8
|
not_blank(format, :format)
|
|
9
|
-
|
|
9
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: format' unless accepted_format?(format)
|
|
10
10
|
|
|
11
11
|
path =
|
|
12
12
|
"orders/#{ERB::Util.url_encode(id)}/report.#{ERB::Util.url_encode(format)}"
|
data/lib/finapps/rest/orders.rb
CHANGED
|
@@ -28,7 +28,7 @@ module FinApps
|
|
|
28
28
|
#
|
|
29
29
|
def list(params = nil)
|
|
30
30
|
return super if params.nil?
|
|
31
|
-
|
|
31
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
|
32
32
|
|
|
33
33
|
super build_query_path(end_point, params)
|
|
34
34
|
end
|
|
@@ -66,9 +66,9 @@ module FinApps
|
|
|
66
66
|
if term
|
|
67
67
|
{
|
|
68
68
|
"$or": [
|
|
69
|
-
{
|
|
70
|
-
{
|
|
71
|
-
{
|
|
69
|
+
{"public_id": {"$regex": "^#{term}", "$options": 'i'}},
|
|
70
|
+
{"applicant.last_name": term},
|
|
71
|
+
{"assignment.last_name": term},
|
|
72
72
|
{
|
|
73
73
|
"requestor.reference_no": {
|
|
74
74
|
"$regex": "^#{term}", "$options": 'i'
|
|
@@ -84,9 +84,9 @@ module FinApps
|
|
|
84
84
|
def status_query(status)
|
|
85
85
|
if status
|
|
86
86
|
if status.is_a?(Array)
|
|
87
|
-
{
|
|
87
|
+
{"status": {"$in": status.map(&:to_i)}}
|
|
88
88
|
else
|
|
89
|
-
{
|
|
89
|
+
{"status": status.to_i}
|
|
90
90
|
end
|
|
91
91
|
else
|
|
92
92
|
{}
|
|
@@ -96,7 +96,7 @@ module FinApps
|
|
|
96
96
|
def assignment_query(assignment)
|
|
97
97
|
# translate "" to null assignment
|
|
98
98
|
if assignment
|
|
99
|
-
{
|
|
99
|
+
{"assignment.operator_id": assignment.empty? ? nil : assignment}
|
|
100
100
|
else
|
|
101
101
|
{}
|
|
102
102
|
end
|
|
@@ -104,7 +104,7 @@ module FinApps
|
|
|
104
104
|
|
|
105
105
|
def consumer_query(consumer)
|
|
106
106
|
if consumer
|
|
107
|
-
{
|
|
107
|
+
{"consumer_id": consumer.empty? ? nil : consumer}
|
|
108
108
|
else
|
|
109
109
|
{}
|
|
110
110
|
end
|
|
@@ -114,8 +114,8 @@ module FinApps
|
|
|
114
114
|
if !search_term && !nil_or_empty?(relation)
|
|
115
115
|
{
|
|
116
116
|
"$or": [
|
|
117
|
-
{
|
|
118
|
-
{
|
|
117
|
+
{"public_id": {"$in": relation}},
|
|
118
|
+
{"original_order_id": {"$in": relation}}
|
|
119
119
|
]
|
|
120
120
|
}
|
|
121
121
|
else
|
|
@@ -9,7 +9,7 @@ module FinApps
|
|
|
9
9
|
super(params, 'p/institution/consumer')
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def show(id, options = {
|
|
12
|
+
def show(id, options = {show_accounts: false})
|
|
13
13
|
results, error_messages = super(nil, "p/institution/consumer/#{id}")
|
|
14
14
|
|
|
15
15
|
if error_messages.empty? && options[:show_accounts]
|
|
@@ -9,7 +9,7 @@ module FinApps
|
|
|
9
9
|
path = 'portfolio/reports'
|
|
10
10
|
|
|
11
11
|
return super path if params.nil?
|
|
12
|
-
|
|
12
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
|
13
13
|
|
|
14
14
|
super build_query_path(path, params)
|
|
15
15
|
end
|
|
@@ -7,7 +7,7 @@ module FinApps
|
|
|
7
7
|
|
|
8
8
|
def list(params = nil)
|
|
9
9
|
return super if params.nil?
|
|
10
|
-
|
|
10
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
|
11
11
|
|
|
12
12
|
super build_query_path(end_point, params)
|
|
13
13
|
end
|
|
@@ -12,7 +12,7 @@ module FinApps
|
|
|
12
12
|
"portfolios/#{ERB::Util.url_encode(portfolio_id)}/consumers/available"
|
|
13
13
|
return super path if params.nil?
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
|
16
16
|
|
|
17
17
|
super build_query_path(path, params)
|
|
18
18
|
end
|
|
@@ -11,7 +11,7 @@ module FinApps
|
|
|
11
11
|
path = build_path(portfolio_id)
|
|
12
12
|
return super path if params.nil?
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
|
15
15
|
|
|
16
16
|
super build_query_path(path, params)
|
|
17
17
|
end
|
|
@@ -8,7 +8,7 @@ module FinApps
|
|
|
8
8
|
|
|
9
9
|
def create(params, path = nil)
|
|
10
10
|
return super nil, path if path == LOGOUT
|
|
11
|
-
|
|
11
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
|
|
12
12
|
|
|
13
13
|
path ||= CONSUMER_LOGIN
|
|
14
14
|
|
|
@@ -6,8 +6,10 @@ module FinApps
|
|
|
6
6
|
def show(consumer_id, signature_request_id)
|
|
7
7
|
not_blank(consumer_id, :consumer_id)
|
|
8
8
|
not_blank(signature_request_id, :signature_request_id)
|
|
9
|
+
|
|
9
10
|
path =
|
|
10
|
-
"consumers/#{ERB::Util.url_encode(consumer_id)}/
|
|
11
|
+
"consumers/#{ERB::Util.url_encode(consumer_id)}/"\
|
|
12
|
+
"documents/#{ERB::Util.url_encode(signature_request_id)}"
|
|
11
13
|
super(nil, path)
|
|
12
14
|
end
|
|
13
15
|
end
|
data/lib/finapps/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe FinApps::REST::AlertDefinitions do
|
|
6
6
|
include SpecHelpers::Client
|
|
7
|
-
subject {
|
|
7
|
+
subject { described_class.new(client) }
|
|
8
8
|
|
|
9
9
|
describe '#list' do
|
|
10
10
|
let(:list) { subject.list(params) }
|
|
@@ -16,9 +16,11 @@ RSpec.describe FinApps::REST::AlertDefinitions do
|
|
|
16
16
|
|
|
17
17
|
it { expect { list }.not_to raise_error }
|
|
18
18
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
19
|
+
|
|
19
20
|
it('performs a get and returns the response') do
|
|
20
21
|
expect(results).to have_key(:records)
|
|
21
22
|
end
|
|
23
|
+
|
|
22
24
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
23
25
|
end
|
|
24
26
|
|
|
@@ -29,14 +31,17 @@ RSpec.describe FinApps::REST::AlertDefinitions do
|
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
context 'when including valid params' do
|
|
32
|
-
let(:params) { {
|
|
34
|
+
let(:params) { {page: 2, sort: '-created_date', requested: 25} }
|
|
33
35
|
|
|
34
36
|
it { expect { list }.not_to raise_error }
|
|
35
37
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
38
|
+
|
|
36
39
|
it('performs a get and returns the response') do
|
|
37
40
|
expect(results).to have_key(:records)
|
|
38
41
|
end
|
|
42
|
+
|
|
39
43
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
44
|
+
|
|
40
45
|
it 'builds query and sends proper request' do
|
|
41
46
|
list
|
|
42
47
|
url =
|
|
@@ -63,10 +68,12 @@ RSpec.describe FinApps::REST::AlertDefinitions do
|
|
|
63
68
|
|
|
64
69
|
it { expect { show }.not_to raise_error }
|
|
65
70
|
it('returns an array') { expect(show).to be_a(Array) }
|
|
71
|
+
|
|
66
72
|
it('performs a get and returns the response') do
|
|
67
73
|
expect(results).to have_key(:_id)
|
|
68
74
|
expect(results).to have_key(:rule_name)
|
|
69
75
|
end
|
|
76
|
+
|
|
70
77
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
71
78
|
end
|
|
72
79
|
|
|
@@ -75,6 +82,7 @@ RSpec.describe FinApps::REST::AlertDefinitions do
|
|
|
75
82
|
|
|
76
83
|
it { expect { show }.not_to raise_error }
|
|
77
84
|
it('results is nil') { expect(results).to be_nil }
|
|
85
|
+
|
|
78
86
|
it('error messages array is populated') do
|
|
79
87
|
expect(errors.first.downcase).to eq('resource not found')
|
|
80
88
|
end
|
|
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe FinApps::REST::AlertOccurrences do
|
|
6
6
|
include SpecHelpers::Client
|
|
7
|
-
subject {
|
|
7
|
+
subject { described_class.new(client) }
|
|
8
8
|
|
|
9
9
|
describe '#list' do
|
|
10
10
|
let(:list) { subject.list(params) }
|
|
@@ -16,9 +16,11 @@ RSpec.describe FinApps::REST::AlertOccurrences do
|
|
|
16
16
|
|
|
17
17
|
it { expect { list }.not_to raise_error }
|
|
18
18
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
19
|
+
|
|
19
20
|
it('performs a get and returns the response') do
|
|
20
21
|
expect(results).to have_key(:records)
|
|
21
22
|
end
|
|
23
|
+
|
|
22
24
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
23
25
|
end
|
|
24
26
|
|
|
@@ -40,10 +42,13 @@ RSpec.describe FinApps::REST::AlertOccurrences do
|
|
|
40
42
|
|
|
41
43
|
it { expect { list }.not_to raise_error }
|
|
42
44
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
45
|
+
|
|
43
46
|
it('performs a get and returns the response') do
|
|
44
47
|
expect(results).to have_key(:records)
|
|
45
48
|
end
|
|
49
|
+
|
|
46
50
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
51
|
+
|
|
47
52
|
it 'builds query and sends proper request' do
|
|
48
53
|
list
|
|
49
54
|
url =
|
data/spec/rest/api_request.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
RSpec.describe FinApps::REST::Client do
|
|
4
4
|
describe '#new' do
|
|
5
5
|
it 'raises for missing company_token' do
|
|
6
|
-
expect {
|
|
6
|
+
expect { described_class.new nil }.to raise_error(
|
|
7
7
|
FinAppsCore::MissingArgumentsError
|
|
8
8
|
)
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
context 'an instance of Client' do
|
|
13
|
-
subject {
|
|
13
|
+
subject { described_class.new(:company_token) }
|
|
14
14
|
|
|
15
15
|
FinApps::REST::Client::RESOURCES.each do |method|
|
|
16
16
|
it("responds to #{method}") { expect(subject).to respond_to(method) }
|
|
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
6
6
|
include SpecHelpers::Client
|
|
7
|
-
subject {
|
|
7
|
+
subject { described_class.new(client) }
|
|
8
8
|
|
|
9
9
|
describe '#list' do
|
|
10
10
|
let(:list) { subject.list(id, params) }
|
|
@@ -24,9 +24,11 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
|
24
24
|
|
|
25
25
|
it { expect { list }.not_to raise_error }
|
|
26
26
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
27
|
+
|
|
27
28
|
it('performs a get and returns the response') do
|
|
28
29
|
expect(results).to have_key(:records)
|
|
29
30
|
end
|
|
31
|
+
|
|
30
32
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -39,14 +41,17 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
|
39
41
|
|
|
40
42
|
context 'when including valid params' do
|
|
41
43
|
let(:id) { 'valid_id' }
|
|
42
|
-
let(:params) { {
|
|
44
|
+
let(:params) { {page: 2, sort: '-created_date', requested: 25} }
|
|
43
45
|
|
|
44
46
|
it { expect { list }.not_to raise_error }
|
|
45
47
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
48
|
+
|
|
46
49
|
it('performs a get and returns the response') do
|
|
47
50
|
expect(results).to have_key(:records)
|
|
48
51
|
end
|
|
52
|
+
|
|
49
53
|
it('returns no error messages') { expect(errors).to be_empty }
|
|
54
|
+
|
|
50
55
|
it 'builds query and sends proper request' do
|
|
51
56
|
list
|
|
52
57
|
url =
|
data/spec/rest/consumers_spec.rb
CHANGED
|
@@ -4,7 +4,8 @@ require 'spec_helpers/client'
|
|
|
4
4
|
RSpec.describe FinApps::REST::Consumers,
|
|
5
5
|
'initialized with valid FinApps::Client object' do
|
|
6
6
|
include SpecHelpers::Client
|
|
7
|
-
subject(:users) {
|
|
7
|
+
subject(:users) { described_class.new(client) }
|
|
8
|
+
|
|
8
9
|
missing_public_id = ': public_id'
|
|
9
10
|
|
|
10
11
|
describe '#create' do
|
|
@@ -24,9 +25,11 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
24
25
|
|
|
25
26
|
it { expect { create }.not_to raise_error }
|
|
26
27
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
|
28
|
+
|
|
27
29
|
it('performs a post and returns the response') do
|
|
28
30
|
expect(results).to have_key(:public_id)
|
|
29
31
|
end
|
|
32
|
+
|
|
30
33
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
|
31
34
|
end
|
|
32
35
|
|
|
@@ -35,6 +38,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
35
38
|
|
|
36
39
|
it { expect { create }.not_to raise_error }
|
|
37
40
|
it('results is nil') { expect(results).to be_nil }
|
|
41
|
+
|
|
38
42
|
it('error messages array is populated') do
|
|
39
43
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
|
40
44
|
end
|
|
@@ -48,10 +52,13 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
48
52
|
|
|
49
53
|
context 'when missing params' do
|
|
50
54
|
let(:params) { nil }
|
|
51
|
-
|
|
55
|
+
|
|
56
|
+
it { expect { list }.not_to raise_error }
|
|
57
|
+
|
|
52
58
|
it('performs a get and returns the response') do
|
|
53
59
|
expect(results).to have_key(:records)
|
|
54
60
|
end
|
|
61
|
+
|
|
55
62
|
it('returns an array of records') { expect(results[:records]).to be_a(Array) }
|
|
56
63
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
57
64
|
end
|
|
@@ -70,14 +77,17 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
70
77
|
}
|
|
71
78
|
end
|
|
72
79
|
|
|
73
|
-
it { expect { list }.
|
|
80
|
+
it { expect { list }.not_to raise_error }
|
|
74
81
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
82
|
+
|
|
75
83
|
it('performs a get and returns the response') do
|
|
76
84
|
expect(results).to have_key(:records)
|
|
77
85
|
end
|
|
86
|
+
|
|
78
87
|
it('returns no error messages') do
|
|
79
88
|
expect(error_messages).to be_empty
|
|
80
89
|
end
|
|
90
|
+
|
|
81
91
|
it 'builds query and sends proper request' do
|
|
82
92
|
list
|
|
83
93
|
url = "#{versioned_api_path}/consumers?page=3&requested=19"
|
|
@@ -95,19 +105,24 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
95
105
|
}
|
|
96
106
|
end
|
|
97
107
|
|
|
98
|
-
it { expect { list }.
|
|
108
|
+
it { expect { list }.not_to raise_error }
|
|
99
109
|
it('returns an array') { expect(list).to be_a(Array) }
|
|
110
|
+
|
|
100
111
|
it('performs a get and returns the response') do
|
|
101
112
|
expect(results).to have_key(:records)
|
|
102
113
|
end
|
|
114
|
+
|
|
103
115
|
it('returns no error messages') do
|
|
104
116
|
expect(error_messages).to be_empty
|
|
105
117
|
end
|
|
118
|
+
|
|
106
119
|
it 'builds query and sends proper request' do
|
|
107
120
|
list
|
|
108
|
-
url = "#{versioned_api_path}/consumers?
|
|
109
|
-
|
|
110
|
-
|
|
121
|
+
url = "#{versioned_api_path}/consumers?"\
|
|
122
|
+
'filter=%7B%22$or%22:%5B%7B%22email%22:%22term%22%7D,' \
|
|
123
|
+
'%7B%22first_name%22:%22term%22%7D,'\
|
|
124
|
+
'%7B%22last_name%22:%22term%22%7D%5D%7D&page=2&requested=25' \
|
|
125
|
+
'&sort=date_created'
|
|
111
126
|
expect(WebMock).to have_requested(:get, url)
|
|
112
127
|
end
|
|
113
128
|
|
|
@@ -120,12 +135,16 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
120
135
|
searchTerm: 'Two terms'
|
|
121
136
|
}
|
|
122
137
|
end
|
|
138
|
+
|
|
123
139
|
it 'treats space as start of a new query for first and last name' do
|
|
124
140
|
list
|
|
125
|
-
url = "#{versioned_api_path}/consumers?
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
141
|
+
url = "#{versioned_api_path}/consumers?"\
|
|
142
|
+
'filter=%7B%22$or%22:%5B%7B%22email%22:%22Two%20terms%22%7D,'\
|
|
143
|
+
'%7B%22first_name%22:%22Two%20terms%22%7D,'\
|
|
144
|
+
'%7B%22last_name%22:%22Two%20terms%22%7D,%7B%22first_name%22:'\
|
|
145
|
+
'%22Two%22%7D,%7B%22last_name%22:%22Two%22%7D,'\
|
|
146
|
+
'%7B%22first_name%22:%22terms%22%7D,%7B%22last_name%22:'\
|
|
147
|
+
'%22terms%22%7D%5D%7D&page=2&requested=25&sort=date_created'
|
|
129
148
|
expect(WebMock).to have_requested(:get, url)
|
|
130
149
|
end
|
|
131
150
|
end
|
|
@@ -149,9 +168,11 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
149
168
|
|
|
150
169
|
it { expect { show }.not_to raise_error }
|
|
151
170
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
|
171
|
+
|
|
152
172
|
it('performs a get and returns the response') do
|
|
153
173
|
expect(results).to have_key(:public_id)
|
|
154
174
|
end
|
|
175
|
+
|
|
155
176
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
|
156
177
|
end
|
|
157
178
|
|
|
@@ -162,6 +183,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
162
183
|
|
|
163
184
|
it { expect { show }.not_to raise_error }
|
|
164
185
|
it('results is nil') { expect(results).to be_nil }
|
|
186
|
+
|
|
165
187
|
it('error messages array is populated') do
|
|
166
188
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
167
189
|
end
|
|
@@ -198,6 +220,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
198
220
|
|
|
199
221
|
it { expect { update }.not_to raise_error }
|
|
200
222
|
it('results is nil') { expect(results).to be_nil }
|
|
223
|
+
|
|
201
224
|
it('error messages array is populated') do
|
|
202
225
|
expect(error_messages.first.downcase).to eq(
|
|
203
226
|
'invalid user id specified.'
|
|
@@ -219,12 +242,15 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
219
242
|
|
|
220
243
|
it { expect { update }.not_to raise_error }
|
|
221
244
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
|
245
|
+
|
|
222
246
|
it('the public_id is on the results') do
|
|
223
247
|
expect(results).to have_key(:public_id)
|
|
224
248
|
end
|
|
249
|
+
|
|
225
250
|
it('the new token is on the results') do
|
|
226
251
|
expect(results).to have_key(:token)
|
|
227
252
|
end
|
|
253
|
+
|
|
228
254
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
|
229
255
|
end
|
|
230
256
|
|
|
@@ -240,6 +266,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
240
266
|
|
|
241
267
|
it { expect { update }.not_to raise_error }
|
|
242
268
|
it('results is nil') { expect(results).to be_nil }
|
|
269
|
+
|
|
243
270
|
it('error messages array is populated') do
|
|
244
271
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
245
272
|
end
|
|
@@ -273,6 +300,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
|
273
300
|
|
|
274
301
|
it { expect { destroy }.not_to raise_error }
|
|
275
302
|
it('results is nil') { expect(results).to be_nil }
|
|
303
|
+
|
|
276
304
|
it('error messages array is populated') do
|
|
277
305
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
278
306
|
end
|