finapps 2.1.4 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -18
- data/.ruby-gemset +1 -1
- data/.travis.yml +5 -2
- data/README.md +1 -1
- data/finapps.gemspec +10 -12
- data/lib/finapps.rb +5 -21
- data/lib/finapps/rest/client.rb +42 -53
- data/lib/finapps/rest/institutions.rb +2 -2
- data/lib/finapps/rest/institutions_forms.rb +2 -2
- data/lib/finapps/rest/order_reports.rb +4 -4
- data/lib/finapps/rest/order_statuses.rb +2 -2
- data/lib/finapps/rest/order_tokens.rb +2 -3
- data/lib/finapps/rest/orders.rb +6 -6
- data/lib/finapps/rest/password_resets.rb +4 -4
- data/lib/finapps/rest/sessions.rb +2 -2
- data/lib/finapps/rest/user_institutions.rb +21 -26
- data/lib/finapps/rest/user_institutions_forms.rb +2 -2
- data/lib/finapps/rest/user_institutions_statuses.rb +2 -2
- data/lib/finapps/rest/users.rb +5 -5
- data/lib/finapps/rest/version.rb +1 -1
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/client_spec.rb +4 -13
- data/spec/rest/institutions_forms_spec.rb +5 -2
- data/spec/rest/institutions_spec.rb +4 -2
- data/spec/rest/order_reports_spec.rb +4 -4
- data/spec/rest/order_statuses_spec.rb +3 -2
- data/spec/rest/order_tokens_spec.rb +3 -2
- data/spec/rest/orders_spec.rb +6 -5
- data/spec/rest/password_resets_spec.rb +4 -4
- data/spec/rest/sessions_spec.rb +2 -2
- data/spec/rest/user_institutions_forms_spec.rb +5 -2
- data/spec/rest/user_institutions_spec.rb +10 -9
- data/spec/rest/user_institutions_statuses_spec.rb +3 -2
- data/spec/rest/users_spec.rb +4 -4
- data/spec/rest/version_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -3
- data/spec/spec_helpers/client.rb +1 -1
- metadata +49 -124
- data/lib/core_extensions/hash/compact.rb +0 -23
- data/lib/core_extensions/object/blank.rb +0 -69
- data/lib/core_extensions/object/is_integer.rb +0 -10
- data/lib/core_extensions/string/json_to_hash.rb +0 -10
- data/lib/finapps/error.rb +0 -17
- data/lib/finapps/middleware/middleware.rb +0 -22
- data/lib/finapps/middleware/request/accept_json.rb +0 -14
- data/lib/finapps/middleware/request/no_encoding_basic_authentication.rb +0 -21
- data/lib/finapps/middleware/request/tenant_authentication.rb +0 -20
- data/lib/finapps/middleware/request/user_agent.rb +0 -15
- data/lib/finapps/middleware/response/custom_logger.rb +0 -41
- data/lib/finapps/middleware/response/raise_error.rb +0 -46
- data/lib/finapps/rest/base_client.rb +0 -122
- data/lib/finapps/rest/configuration.rb +0 -31
- data/lib/finapps/rest/connection.rb +0 -35
- data/lib/finapps/rest/credentials.rb +0 -21
- data/lib/finapps/rest/defaults.rb +0 -80
- data/lib/finapps/rest/resources.rb +0 -64
- data/lib/finapps/utils/loggeable.rb +0 -14
- data/lib/finapps/utils/parameter_filter.rb +0 -32
- data/spec/core_extensions/hash/compact_spec.rb +0 -21
- data/spec/core_extensions/object/is_integer_spec.rb +0 -17
- data/spec/middleware/request/accept_json_spec.rb +0 -12
- data/spec/middleware/request/no_encoding_basic_authentication_spec.rb +0 -32
- data/spec/middleware/request/tenant_authentication_spec.rb +0 -34
- data/spec/middleware/request/user_agent_spec.rb +0 -12
- data/spec/middleware/response/raise_error_spec.rb +0 -24
- data/spec/rest/base_client_spec.rb +0 -120
- data/spec/rest/configuration_spec.rb +0 -39
- data/spec/rest/credentials_spec.rb +0 -20
- data/spec/rest/resources_spec.rb +0 -76
- data/spec/rest/timeout_spec.rb +0 -9
- data/spec/support/fixtures/relevance_ruleset_names.json +0 -47
- data/spec/utils/parameter_filter_spec.rb +0 -23
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe FinApps::REST::Configuration do
|
3
|
-
describe '#new' do
|
4
|
-
context 'for invalid timeout configuration' do
|
5
|
-
subject { FinApps::REST::Configuration.new(timeout: 'whatever') }
|
6
|
-
it { expect { subject }.to raise_error(FinApps::InvalidArgumentsError, 'Invalid argument. {timeout: whatever}') }
|
7
|
-
end
|
8
|
-
|
9
|
-
context 'for missing timeout configuration' do
|
10
|
-
subject { FinApps::REST::Configuration.new(timeout: nil) }
|
11
|
-
it 'should have a default timeout value' do
|
12
|
-
expect(subject.timeout).to eq(FinApps::REST::Defaults::DEFAULTS[:timeout])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'for invalid host configuration' do
|
17
|
-
subject { FinApps::REST::Configuration.new(host: 'whatever') }
|
18
|
-
it { expect { subject }.to raise_error(FinApps::InvalidArgumentsError, 'Invalid argument. {host: whatever}') }
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'for missing host configuration' do
|
22
|
-
subject { FinApps::REST::Configuration.new(host: nil) }
|
23
|
-
it 'should have a default host value' do
|
24
|
-
expect(subject.host).to eq(FinApps::REST::Defaults::DEFAULTS[:host])
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#valid_user_credentials??' do
|
30
|
-
context 'when user credentials were not set' do
|
31
|
-
subject { FinApps::REST::Configuration.new(host: nil) }
|
32
|
-
it { expect(subject.valid_user_credentials?).to eq(false) }
|
33
|
-
end
|
34
|
-
context 'when user credentials were set' do
|
35
|
-
subject { FinApps::REST::Configuration.new(user_identifier: 1, user_token: 2) }
|
36
|
-
it { expect(subject.valid_user_credentials?).to eq(true) }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe FinApps::REST::Credentials do
|
3
|
-
describe '#valid?' do
|
4
|
-
context 'when missing identifier' do
|
5
|
-
it { expect(FinApps::REST::Credentials.new(nil, :token).valid?).to eql(false) }
|
6
|
-
end
|
7
|
-
|
8
|
-
context 'when missing token' do
|
9
|
-
it { expect(FinApps::REST::Credentials.new(:identifier, nil).valid?).to eql(false) }
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'when missing both identifier and token' do
|
13
|
-
it { expect(FinApps::REST::Credentials.new(nil, nil).valid?).to eql(false) }
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when having identifier and token' do
|
17
|
-
it { expect(FinApps::REST::Credentials.new(:identifier, :token).valid?).to eql(true) }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/spec/rest/resources_spec.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe FinApps::REST::Resources do
|
3
|
-
let(:client) { FinApps::REST::Client.new :company_identifier, :company_token }
|
4
|
-
let(:results) { subject[0] }
|
5
|
-
let(:error_messages) { subject[1] }
|
6
|
-
|
7
|
-
describe '#new' do
|
8
|
-
context 'when client is nil' do
|
9
|
-
subject { FinApps::REST::Resources.new(nil) }
|
10
|
-
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError, 'Missing argument: client.') }
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'when client is not a FinApps::REST::Client object' do
|
14
|
-
subject { FinApps::REST::Resources.new(1) }
|
15
|
-
it { expect { subject }.to raise_error(FinApps::InvalidArgumentsError, 'Invalid argument: client.') }
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when client param is set' do
|
19
|
-
subject { FinApps::REST::Resources.new(client) }
|
20
|
-
it { expect { subject }.not_to raise_error }
|
21
|
-
it('assigns @client') { expect(subject.client).to eq(client) }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#create' do
|
26
|
-
context 'when valid params are provided' do
|
27
|
-
subject { FinApps::REST::Resources.new(client).create }
|
28
|
-
it { expect { subject }.not_to raise_error }
|
29
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
30
|
-
it('performs a post and returns the response') { expect(results).to respond_to(:public_id) }
|
31
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#update' do
|
36
|
-
context 'when valid params are provided' do
|
37
|
-
subject { FinApps::REST::Resources.new(client).update }
|
38
|
-
it { expect { subject }.not_to raise_error }
|
39
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
40
|
-
it('performs a put and returns the response') { expect(results).to respond_to(:public_id) }
|
41
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#list' do
|
46
|
-
context 'when valid params are provided' do
|
47
|
-
subject { FinApps::REST::Resources.new(client).list(nil) }
|
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(results).to respond_to(:resources) }
|
52
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#show' do
|
57
|
-
context 'when valid params are provided' do
|
58
|
-
subject { FinApps::REST::Resources.new(client).show(:id) }
|
59
|
-
|
60
|
-
it { expect { subject }.not_to raise_error }
|
61
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
62
|
-
it('performs a get and returns the response') { expect(results).to respond_to(:public_id) }
|
63
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#destroy' do
|
68
|
-
context 'when valid params are provided' do
|
69
|
-
subject { FinApps::REST::Resources.new(client).destroy(:id) }
|
70
|
-
it { expect { subject }.not_to raise_error }
|
71
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
72
|
-
it('performs a delete and returns an empty response') { expect(results).to be_nil }
|
73
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
data/spec/rest/timeout_spec.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe FinApps::REST::Orders do
|
3
|
-
let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
4
|
-
|
5
|
-
describe 'timeout' do
|
6
|
-
subject { FinApps::REST::Orders.new(client).show(:timeout) }
|
7
|
-
it { expect { subject }.to raise_error(FinApps::ApiSessionTimeoutError) }
|
8
|
-
end
|
9
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
[
|
2
|
-
"accounts_overview",
|
3
|
-
"alert_cash_withdrawal",
|
4
|
-
"alert_deposits",
|
5
|
-
"alert_low_avg_balance",
|
6
|
-
"alert_low_cash_flow",
|
7
|
-
"alert_merchant_breach",
|
8
|
-
"budet_wip03",
|
9
|
-
"budget",
|
10
|
-
"budget_wip",
|
11
|
-
"budget_wip02",
|
12
|
-
"budget_wip03",
|
13
|
-
"budget_wip04",
|
14
|
-
"budget_wip05",
|
15
|
-
"budget_wip06",
|
16
|
-
"budget_wip07",
|
17
|
-
"budget_wip08",
|
18
|
-
"bug_test",
|
19
|
-
"cashflow",
|
20
|
-
"cashflow_02",
|
21
|
-
"cashflow_detail",
|
22
|
-
"cashflow_old",
|
23
|
-
"demo",
|
24
|
-
"formfree_structure",
|
25
|
-
"fraud",
|
26
|
-
"fraud_alert_cash_withdrawal",
|
27
|
-
"fraud_alert_double_charge",
|
28
|
-
"hello_dom_breakpoint",
|
29
|
-
"hello_jira",
|
30
|
-
"hello_temp",
|
31
|
-
"iav_avg_dep_velocity",
|
32
|
-
"iav_avg_dly_bal",
|
33
|
-
"iav_avg_income",
|
34
|
-
"iav_avg_spend",
|
35
|
-
"iav_balance_summary",
|
36
|
-
"iav_cash_flow",
|
37
|
-
"iav_eod_balance",
|
38
|
-
"iav_low_bal_trends",
|
39
|
-
"iav_nsf",
|
40
|
-
"iav_payroll",
|
41
|
-
"iav_report_summary",
|
42
|
-
"iav_risk_score",
|
43
|
-
"inventory_testing",
|
44
|
-
"loopWIP",
|
45
|
-
"mysql",
|
46
|
-
"simple_rule_data"
|
47
|
-
]
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
class FakeClass
|
3
|
-
include ::FinApps::Utils::ParameterFilter
|
4
|
-
end
|
5
|
-
|
6
|
-
RSpec.describe FinApps::Utils::ParameterFilter do
|
7
|
-
describe '#skip_sensitive_data' do
|
8
|
-
context 'when provided with sensitive data' do
|
9
|
-
let(:unfiltered_params) do
|
10
|
-
{password: 'FinApps@123', password_confirm: 'FinApps@123', token: '123456',
|
11
|
-
login: 'sammysosa', username: 'johnny', name: 'george'}
|
12
|
-
end
|
13
|
-
let(:filtered_params) do
|
14
|
-
{password: '[REDACTED]', password_confirm: '[REDACTED]', token: '[REDACTED]',
|
15
|
-
login: '[REDACTED]', username: '[REDACTED]', name: 'george'}
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'filters out sensitive values' do
|
19
|
-
expect(FakeClass.new.skip_sensitive_data(unfiltered_params)).to eq(filtered_params)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|