finapps_core 5.0.11 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +7 -0
- data/.github/release-drafter.yml +1 -1
- data/.github/workflows/ci.yaml +41 -0
- data/.github/workflows/release.yml +41 -41
- data/.github/workflows/verify-pr-labeled.yml +12 -3
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/README.md +1 -4
- data/finapps_core.gemspec +12 -10
- data/lib/finapps_core.rb +1 -0
- data/lib/finapps_core/middleware/middleware.rb +2 -1
- data/lib/finapps_core/middleware/request/x_tenant_id.rb +20 -0
- data/lib/finapps_core/rest/configuration.rb +26 -8
- data/lib/finapps_core/rest/connection.rb +1 -0
- data/lib/finapps_core/rest/defaults.rb +2 -2
- data/lib/finapps_core/version.rb +1 -1
- data/spec/middleware/request/x_tenant_id_spec.rb +16 -0
- data/spec/rest/configuration_spec.rb +37 -9
- data/spec/rest/defaults_spec.rb +18 -5
- data/spec/spec_helper.rb +13 -5
- metadata +115 -77
- data/.github/workflows/main.yaml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95f8aa98b4a17b4497c2940488e03953b5898ee1d3dfcb2fee61d537484075bf
|
4
|
+
data.tar.gz: 84c70cff196aec1f0b31a534e5c7c3b142f68ba308506ed823a654e89da182b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82aa422c010d8eaa84b5b12f886107ac096b64dbedd07d50ec218ceced322d1fefb72b11cc3bff6a60f4bf466f09918bb081dab9a062ac51adfca2c54d0a2ce3
|
7
|
+
data.tar.gz: 790061688554488ec8fdd3c8522409a1a61813f8063bfdb1083be32305b0a01eb3c6a0c1f60931364112521e71fcbbe846572ee7e8c86a1fd76a47265d977db5
|
data/.github/release-drafter.yml
CHANGED
@@ -39,7 +39,7 @@ exclude-labels:
|
|
39
39
|
- invalid
|
40
40
|
|
41
41
|
template: |
|
42
|
-
## [$RESOLVED_VERSION](https://github.com/finapps/ruby-client/compare/$PREVIOUS_TAG...$RESOLVED_VERSION)
|
42
|
+
## [$RESOLVED_VERSION](https://github.com/finapps/ruby-client-core/compare/$PREVIOUS_TAG...$RESOLVED_VERSION)
|
43
43
|
$CHANGES
|
44
44
|
|
45
45
|
replacers:
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: Continuous Integration
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths-ignore:
|
6
|
+
- ".github/**"
|
7
|
+
- ".VERSION"
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- ".github/**"
|
11
|
+
- ".VERSION"
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
os: [ubuntu-latest]
|
19
|
+
ruby: [2.6, 2.7, '3.0']
|
20
|
+
runs-on: ${{ matrix.os }}
|
21
|
+
steps:
|
22
|
+
- name: Checkout source code
|
23
|
+
uses: actions/checkout@v2.3.4
|
24
|
+
|
25
|
+
- name: Install required ruby version
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
bundler-cache: true # runs 'bundle install' and caches gems
|
29
|
+
|
30
|
+
- name: Run rspec with coverage
|
31
|
+
run: |
|
32
|
+
COVERAGE=true bundle exec rspec
|
33
|
+
|
34
|
+
- name: Run rubocop
|
35
|
+
run: |
|
36
|
+
bundle exec rubocop --parallel
|
37
|
+
|
38
|
+
- name: Run Skunk on Project
|
39
|
+
run: |
|
40
|
+
gem install skunk
|
41
|
+
skunk lib/
|
@@ -9,46 +9,46 @@ jobs:
|
|
9
9
|
strategy:
|
10
10
|
fail-fast: true
|
11
11
|
|
12
|
-
steps:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
steps:
|
13
|
+
- name: Checkout source code
|
14
|
+
uses: actions/checkout@v2.3.4
|
15
|
+
with:
|
16
|
+
persist-credentials: false
|
17
|
+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
ruby-version: '2.6'
|
21
|
-
|
22
|
-
- name: Get version from latest tag
|
23
|
-
id: get_version
|
24
|
-
uses: battila7/get-version-action@v2
|
19
|
+
- name: Install required ruby version
|
20
|
+
uses: ruby/setup-ruby@v1
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
22
|
+
- name: Get version from latest tag
|
23
|
+
id: get_version
|
24
|
+
uses: battila7/get-version-action@v2
|
25
|
+
|
26
|
+
- name: Bump version
|
27
|
+
run: |
|
28
|
+
gem install -N gem-release
|
29
|
+
git config --local user.email "action@github.com"
|
30
|
+
git config --local user.name "GitHub Action"
|
31
|
+
gem bump --skip-ci --version ${{ steps.get_version.outputs.version-without-v }}
|
32
|
+
|
33
|
+
- name: Push changes
|
34
|
+
uses: ad-m/github-push-action@master
|
35
|
+
with:
|
36
|
+
# GitHub Actions token does not support pushing to protected branches.
|
37
|
+
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
38
|
+
#
|
39
|
+
# A manually populated`PERSONAL_ACCESS_TOKEN` environment variable
|
40
|
+
# with permissions to push to a protected branch must be used.
|
41
|
+
# not ideal - keep eyes open for a better solution
|
42
|
+
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
43
|
+
|
44
|
+
- name: Release gem to rubygems.org
|
45
|
+
run: |
|
46
|
+
set +x
|
47
|
+
mkdir -p ~/.gem
|
48
|
+
cat << EOF > ~/.gem/credentials
|
49
|
+
---
|
50
|
+
:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
|
51
|
+
EOF
|
52
|
+
chmod 0600 ~/.gem/credentials
|
53
|
+
set -x
|
54
|
+
gem release
|
@@ -7,8 +7,17 @@ jobs:
|
|
7
7
|
label:
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
steps:
|
10
|
-
- uses: mheap/github-action-required-labels@v1
|
10
|
+
- uses: mheap/github-action-required-labels@v1.1.2
|
11
11
|
with:
|
12
|
-
mode:
|
12
|
+
mode: minimum
|
13
13
|
count: 1
|
14
|
-
|
14
|
+
#
|
15
|
+
# Releases will group changes under Added/Fixed/Changed sub-headers
|
16
|
+
# based on labels and follwing these rules:
|
17
|
+
#
|
18
|
+
# Added: enhancement
|
19
|
+
# Fixed: bug
|
20
|
+
# Changed: maintenance, change, dependencies (used by Dependabot)
|
21
|
+
# Ignore: skip-changelog
|
22
|
+
#
|
23
|
+
labels: "enhancement, bug, maintenance, change, dependencies, skip-changelog"
|
data/.rubocop.yml
CHANGED
@@ -46,7 +46,7 @@ Metrics/ClassLength:
|
|
46
46
|
- app/controllers/orders_controller.rb
|
47
47
|
- app/models/order.rb
|
48
48
|
Metrics/BlockLength:
|
49
|
-
|
49
|
+
IgnoredMethods: ['describe', 'context']
|
50
50
|
Exclude:
|
51
51
|
- finapps_core.gemspec
|
52
52
|
- config/environments/**/**
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.2
|
data/README.md
CHANGED
@@ -3,9 +3,6 @@ FinApps Ruby-Client-Core
|
|
3
3
|
========================
|
4
4
|
|
5
5
|
[![Gem Version](https://img.shields.io/gem/v/finapps_core.svg)](https://rubygems.org/gems/finapps_core)
|
6
|
-
[![Build Status](https://travis-ci.org/finapps/ruby-client-core.svg?branch=master)](https://travis-ci.org/finapps/ruby-client-core)
|
7
|
-
[![Code Climate](https://codeclimate.com/github/finapps/ruby-client-core/badges/gpa.svg)](https://codeclimate.com/github/finapps/ruby-client-core)
|
8
|
-
[![Test Coverage](https://codeclimate.com/github/finapps/ruby-client-core/badges/coverage.svg)](https://codeclimate.com/github/finapps/ruby-client-core/coverage)
|
9
6
|
[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://finapps.mit-license.org)
|
10
7
|
|
11
8
|
Common library for Ruby clients.
|
@@ -18,4 +15,4 @@ See Financial Apps API [Ruby Client][ruby-client].
|
|
18
15
|
[FinancialApps.com][financialapps]
|
19
16
|
|
20
17
|
[ruby-client]: https://github.com/finapps/ruby-client
|
21
|
-
[financialapps]: https://financialapps.com
|
18
|
+
[financialapps]: https://financialapps.com
|
data/finapps_core.gemspec
CHANGED
@@ -20,18 +20,20 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = Dir['spec/**/*.rb']
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'faraday', '~> 1.
|
24
|
-
spec.add_runtime_dependency 'faraday_middleware', '~> 1.0', '>= 1.0'
|
23
|
+
spec.add_runtime_dependency 'faraday', '~> 1.4', '>= 1.4.0'
|
24
|
+
spec.add_runtime_dependency 'faraday_middleware', '~> 1.0', '>= 1.0.0'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
27
|
-
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.16'
|
28
27
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
30
|
-
spec.add_development_dependency 'rubocop', '~>
|
31
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
32
|
-
spec.add_development_dependency 'rubocop-
|
33
|
-
spec.add_development_dependency '
|
34
|
-
spec.add_development_dependency '
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.10', '>= 3.10.0'
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 1.9', '>= 1.9.1'
|
30
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.9', '>= 1.9.2'
|
31
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5', '>= 0.5.1'
|
32
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.2', '>= 2.2.0'
|
33
|
+
spec.add_development_dependency 'simplecov', '~> 0.21', '>= 0.21.2'
|
34
|
+
spec.add_development_dependency 'simplecov-console', '~> 0.9'
|
35
|
+
spec.add_development_dependency 'sinatra', '~> 2.1', '>= 2.1.0'
|
36
|
+
spec.add_development_dependency 'webmock', '~> 3.12', '>= 3.12.2'
|
35
37
|
|
36
38
|
spec.extra_rdoc_files = %w(README.md LICENSE)
|
37
39
|
spec.rdoc_options = %w(--line-numbers --inline-source --title finapps-ruby-core --main README.md)
|
data/lib/finapps_core.rb
CHANGED
@@ -18,6 +18,7 @@ require 'finapps_core/middleware/request/accept_json'
|
|
18
18
|
require 'finapps_core/middleware/request/user_agent'
|
19
19
|
require 'finapps_core/middleware/request/request_id'
|
20
20
|
require 'finapps_core/middleware/request/x_consumer_id'
|
21
|
+
require 'finapps_core/middleware/request/x_tenant_id'
|
21
22
|
require 'finapps_core/middleware/response/raise_error'
|
22
23
|
require 'finapps_core/middleware/middleware'
|
23
24
|
|
@@ -20,7 +20,8 @@ module FinAppsCore
|
|
20
20
|
no_encoding_basic_authentication: -> { NoEncodingBasicAuthentication },
|
21
21
|
tenant_authentication: -> { TenantAuthentication },
|
22
22
|
request_id: -> { RequestId },
|
23
|
-
x_consumer_id: -> { XConsumerId }
|
23
|
+
x_consumer_id: -> { XConsumerId },
|
24
|
+
x_tenant_id: -> { XTenantId }
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FinAppsCore
|
4
|
+
module Middleware
|
5
|
+
# Adds a header to specify tenant to retrieve data for
|
6
|
+
class XTenantId < Faraday::Middleware
|
7
|
+
KEY = 'X-Tenant-ID' unless defined? KEY
|
8
|
+
|
9
|
+
def initialize(app, x_tenant_id)
|
10
|
+
super(app)
|
11
|
+
@x_tenant_id = x_tenant_id.to_s.strip
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
env[:request_headers][KEY] ||= @x_tenant_id
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -8,13 +8,14 @@ module FinAppsCore
|
|
8
8
|
|
9
9
|
attr_accessor :tenant_token, :user_identifier, :user_token,
|
10
10
|
:host, :proxy, :timeout, :retry_limit, :rashify,
|
11
|
-
:log_level, :request_id, :consumer_id
|
11
|
+
:log_level, :request_id, :consumer_id, :tenant_id
|
12
12
|
|
13
13
|
def initialize(options = {})
|
14
|
-
FinAppsCore::REST::Defaults::DEFAULTS
|
15
|
-
|
16
|
-
fail_invalid_host
|
14
|
+
assign_attributes FinAppsCore::REST::Defaults::DEFAULTS
|
15
|
+
.merge(options.compact)
|
17
16
|
fail_invalid_timeout
|
17
|
+
fail_invalid_host
|
18
|
+
@host = @host.chomp('/')
|
18
19
|
end
|
19
20
|
|
20
21
|
def valid_user_credentials?
|
@@ -23,6 +24,27 @@ module FinAppsCore
|
|
23
24
|
|
24
25
|
private
|
25
26
|
|
27
|
+
def assign_attributes(new_attributes)
|
28
|
+
unless new_attributes.respond_to?(:each_pair)
|
29
|
+
fail ArgumentError, 'When assigning attributes, '\
|
30
|
+
"you must pass a hash argument, #{new_attributes.class} passed."
|
31
|
+
end
|
32
|
+
return if new_attributes.empty?
|
33
|
+
|
34
|
+
_assign_attributes new_attributes
|
35
|
+
end
|
36
|
+
|
37
|
+
def _assign_attributes(attributes)
|
38
|
+
attributes.each {|key, value| _assign_attribute(key, value) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def _assign_attribute(key, value)
|
42
|
+
setter = :"#{key}="
|
43
|
+
fail UnknownAttributeError.new(self, key.to_s) unless respond_to?(setter)
|
44
|
+
|
45
|
+
public_send(setter, value)
|
46
|
+
end
|
47
|
+
|
26
48
|
def fail_invalid_host
|
27
49
|
return if valid_host?
|
28
50
|
|
@@ -40,10 +62,6 @@ module FinAppsCore
|
|
40
62
|
def valid_host?
|
41
63
|
host.start_with?('http://', 'https://')
|
42
64
|
end
|
43
|
-
|
44
|
-
def remove_empty_options(hash)
|
45
|
-
hash.reject {|_, value| value.nil? }
|
46
|
-
end
|
47
65
|
end
|
48
66
|
end
|
49
67
|
end
|
@@ -29,6 +29,7 @@ module FinAppsCore
|
|
29
29
|
conn.request :accept_json
|
30
30
|
conn.request :user_agent
|
31
31
|
conn.request :x_consumer_id, config.consumer_id if config.consumer_id
|
32
|
+
conn.request :x_tenant_id, config.tenant_id if config.tenant_id
|
32
33
|
conn.request :json
|
33
34
|
conn.request :retry
|
34
35
|
conn.request :multipart
|
@@ -5,11 +5,11 @@ require 'logger'
|
|
5
5
|
module FinAppsCore
|
6
6
|
module REST
|
7
7
|
module Defaults
|
8
|
-
API_VERSION = '
|
8
|
+
API_VERSION = '5'
|
9
9
|
|
10
10
|
# noinspection SpellCheckingInspection
|
11
11
|
DEFAULTS = {
|
12
|
-
host: 'https://api.
|
12
|
+
host: 'https://api.allcleardecisioning.com',
|
13
13
|
timeout: 30,
|
14
14
|
proxy: nil,
|
15
15
|
log_level: Logger::UNKNOWN
|
data/lib/finapps_core/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe FinAppsCore::Middleware::XTenantId do
|
4
|
+
let(:id) { 'valid_tenant_id' }
|
5
|
+
let(:fake_app) { proc {|env| env } }
|
6
|
+
let(:env) { {request_headers: {}} }
|
7
|
+
|
8
|
+
describe '#call' do
|
9
|
+
subject(:x_tenant_id) { described_class.new(fake_app, id) }
|
10
|
+
|
11
|
+
it('generates an X-Tenant-ID header') do
|
12
|
+
key = FinAppsCore::Middleware::XTenantId::KEY
|
13
|
+
expect(x_tenant_id.call(env)[:request_headers][key]).to eq(id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -4,33 +4,59 @@ require 'finapps_core/error'
|
|
4
4
|
|
5
5
|
RSpec.describe FinAppsCore::REST::Configuration do
|
6
6
|
describe '#new' do
|
7
|
+
expected_error = FinAppsCore::InvalidArgumentsError
|
8
|
+
default_host = FinAppsCore::REST::Defaults::DEFAULTS[:host]
|
9
|
+
default_timeout = FinAppsCore::REST::Defaults::DEFAULTS[:timeout]
|
10
|
+
|
7
11
|
context 'with invalid timeout configuration' do
|
8
|
-
subject(:configuration) { described_class.new(timeout: '
|
12
|
+
subject(:configuration) { described_class.new(timeout: 'foo') }
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
it {
|
15
|
+
expect { configuration }
|
16
|
+
.to raise_error(expected_error, 'Invalid argument. {timeout: foo}')
|
17
|
+
}
|
12
18
|
end
|
13
19
|
|
14
20
|
context 'with missing timeout configuration' do
|
15
21
|
subject(:configuration) { described_class.new(timeout: nil) }
|
16
22
|
|
17
23
|
it 'has a default timeout value' do
|
18
|
-
expect(configuration.timeout).to eq(
|
24
|
+
expect(configuration.timeout).to eq(default_timeout)
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
22
28
|
context 'with invalid host configuration' do
|
23
|
-
subject(:configuration) { described_class.new(host: '
|
29
|
+
subject(:configuration) { described_class.new(host: 'foo') }
|
24
30
|
|
25
|
-
|
26
|
-
|
31
|
+
it do
|
32
|
+
expect { configuration }
|
33
|
+
.to raise_error(expected_error, 'Invalid argument. {host: foo}')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with valid host configuration' do
|
38
|
+
subject(:configuration) { described_class.new(host: 'https://api.com/') }
|
39
|
+
|
40
|
+
it 'the default host value is not used' do
|
41
|
+
expect(configuration.host).not_to eq(default_host)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'the provided host value is assigned to host' do
|
45
|
+
expect(configuration.host).to include('https://api.com')
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when given host value ends on /' do
|
49
|
+
it 'the / character is removed' do
|
50
|
+
expect(configuration.host).not_to end_with('/')
|
51
|
+
end
|
52
|
+
end
|
27
53
|
end
|
28
54
|
|
29
55
|
context 'with missing host configuration' do
|
30
56
|
subject(:configuration) { described_class.new(host: nil) }
|
31
57
|
|
32
58
|
it 'has a default host value' do
|
33
|
-
expect(configuration.host).to eq(
|
59
|
+
expect(configuration.host).to eq(default_host)
|
34
60
|
end
|
35
61
|
end
|
36
62
|
end
|
@@ -43,7 +69,9 @@ RSpec.describe FinAppsCore::REST::Configuration do
|
|
43
69
|
end
|
44
70
|
|
45
71
|
context 'when user credentials were set' do
|
46
|
-
subject(:configuration)
|
72
|
+
subject(:configuration) do
|
73
|
+
described_class.new(user_identifier: 1, user_token: 2)
|
74
|
+
end
|
47
75
|
|
48
76
|
it { expect(configuration.valid_user_credentials?).to eq(true) }
|
49
77
|
end
|
data/spec/rest/defaults_spec.rb
CHANGED
@@ -6,12 +6,25 @@ RSpec.describe FinAppsCore::REST::Defaults do
|
|
6
6
|
describe 'set constants' do
|
7
7
|
before { stub_const(described_class.to_s, fake_class) }
|
8
8
|
|
9
|
-
it('sets API_VERSION') { expect(described_class::API_VERSION).to eq '
|
9
|
+
it('sets API_VERSION') { expect(described_class::API_VERSION).to eq '5' }
|
10
10
|
it('sets DEFAULTS') { expect(described_class::DEFAULTS).to be_a(Hash) }
|
11
11
|
it('freezes DEFAULTS') { expect(described_class::DEFAULTS).to be_frozen }
|
12
|
-
|
13
|
-
it('sets DEFAULTS[:
|
14
|
-
|
15
|
-
|
12
|
+
|
13
|
+
it('sets DEFAULTS[:host]') {
|
14
|
+
expected = 'https://api.allcleardecisioning.com'
|
15
|
+
expect(described_class::DEFAULTS[:host]).to eq expected
|
16
|
+
}
|
17
|
+
|
18
|
+
it('sets DEFAULTS[:timeout]') {
|
19
|
+
expect(described_class::DEFAULTS[:timeout]).to eq 30
|
20
|
+
}
|
21
|
+
|
22
|
+
it('does not set DEFAULTS[:proxy]') {
|
23
|
+
expect(described_class::DEFAULTS[:proxy]).to be_nil
|
24
|
+
}
|
25
|
+
|
26
|
+
it('sets DEFAULTS[:log_level]') {
|
27
|
+
expect(described_class::DEFAULTS[:log_level]).to eq Logger::UNKNOWN
|
28
|
+
}
|
16
29
|
end
|
17
30
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
if ENV['
|
4
|
-
# require 'codeclimate-test-reporter'
|
5
|
-
# CodeClimate::TestReporter.start
|
3
|
+
if ENV['COVERAGE'] == 'true'
|
6
4
|
require 'simplecov'
|
7
|
-
|
5
|
+
require 'simplecov-console'
|
6
|
+
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
SimpleCov::Formatter::Console,
|
10
|
+
]
|
11
|
+
|
12
|
+
SimpleCov.start do
|
13
|
+
track_files 'lib/**/*.rb'
|
14
|
+
end
|
15
|
+
|
16
|
+
puts "Using SimpleCov v#{SimpleCov::VERSION}"
|
8
17
|
end
|
9
18
|
|
10
19
|
require 'bundler/setup'
|
@@ -33,7 +42,6 @@ RSpec.configure do |config|
|
|
33
42
|
base_url = "#{FinAppsCore::REST::Defaults::DEFAULTS[:host]}/v#{FinAppsCore::REST::Defaults::API_VERSION}/"
|
34
43
|
stub_request(:any, /#{base_url}/).to_rack(::FakeApi)
|
35
44
|
end
|
36
|
-
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
37
45
|
end
|
38
46
|
|
39
47
|
VALID_CREDENTIALS = {identifier: '49fb918d-7e71-44dd-7378-58f19606df2a',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,220 +16,254 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.4'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.0
|
22
|
+
version: 1.4.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
29
|
+
version: '1.4'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0
|
32
|
+
version: 1.4.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: faraday_middleware
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.0'
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '1.0'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.0.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.0'
|
50
47
|
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '1.0'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.0.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: bundler
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '2.
|
59
|
+
version: '2.2'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 2.
|
62
|
+
version: 2.2.16
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '2.
|
69
|
+
version: '2.2'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 2.
|
72
|
+
version: 2.2.16
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
74
|
+
name: rake
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '13.0'
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 13.0.1
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 13.0.1
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: rspec
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '3.10'
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 3.10.0
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '3.10'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 3.10.0
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
114
|
+
name: rubocop
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - ">="
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: 3.8.0
|
120
117
|
- - "~>"
|
121
118
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
119
|
+
version: '1.9'
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.9.1
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - ">="
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: 3.8.0
|
130
127
|
- - "~>"
|
131
128
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
129
|
+
version: '1.9'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.9.1
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
|
-
name: rubocop
|
134
|
+
name: rubocop-performance
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: 0.86.0
|
140
137
|
- - "~>"
|
141
138
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
139
|
+
version: '1.9'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.9.2
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- - ">="
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: 0.86.0
|
150
147
|
- - "~>"
|
151
148
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
149
|
+
version: '1.9'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.9.2
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop-
|
154
|
+
name: rubocop-rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '0.5'
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
162
|
+
version: 0.5.1
|
163
163
|
type: :development
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - "~>"
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
169
|
+
version: '0.5'
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
172
|
+
version: 0.5.1
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: rubocop-rspec
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '2.2'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 2.2.0
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '2.2'
|
177
190
|
- - ">="
|
178
191
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
192
|
+
version: 2.2.0
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: simplecov
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
180
197
|
- - "~>"
|
181
198
|
- !ruby/object:Gem::Version
|
182
|
-
version: '
|
199
|
+
version: '0.21'
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 0.21.2
|
183
203
|
type: :development
|
184
204
|
prerelease: false
|
185
205
|
version_requirements: !ruby/object:Gem::Requirement
|
186
206
|
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0.21'
|
187
210
|
- - ">="
|
188
211
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
212
|
+
version: 0.21.2
|
213
|
+
- !ruby/object:Gem::Dependency
|
214
|
+
name: simplecov-console
|
215
|
+
requirement: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - "~>"
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0.9'
|
220
|
+
type: :development
|
221
|
+
prerelease: false
|
222
|
+
version_requirements: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
190
224
|
- - "~>"
|
191
225
|
- !ruby/object:Gem::Version
|
192
|
-
version: '
|
226
|
+
version: '0.9'
|
193
227
|
- !ruby/object:Gem::Dependency
|
194
228
|
name: sinatra
|
195
229
|
requirement: !ruby/object:Gem::Requirement
|
196
230
|
requirements:
|
197
231
|
- - "~>"
|
198
232
|
- !ruby/object:Gem::Version
|
199
|
-
version: '2.
|
233
|
+
version: '2.1'
|
200
234
|
- - ">="
|
201
235
|
- !ruby/object:Gem::Version
|
202
|
-
version: 2.0
|
236
|
+
version: 2.1.0
|
203
237
|
type: :development
|
204
238
|
prerelease: false
|
205
239
|
version_requirements: !ruby/object:Gem::Requirement
|
206
240
|
requirements:
|
207
241
|
- - "~>"
|
208
242
|
- !ruby/object:Gem::Version
|
209
|
-
version: '2.
|
243
|
+
version: '2.1'
|
210
244
|
- - ">="
|
211
245
|
- !ruby/object:Gem::Version
|
212
|
-
version: 2.0
|
246
|
+
version: 2.1.0
|
213
247
|
- !ruby/object:Gem::Dependency
|
214
248
|
name: webmock
|
215
249
|
requirement: !ruby/object:Gem::Requirement
|
216
250
|
requirements:
|
217
|
-
- - ">="
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
version: 3.6.0
|
220
251
|
- - "~>"
|
221
252
|
- !ruby/object:Gem::Version
|
222
|
-
version: '3.
|
253
|
+
version: '3.12'
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 3.12.2
|
223
257
|
type: :development
|
224
258
|
prerelease: false
|
225
259
|
version_requirements: !ruby/object:Gem::Requirement
|
226
260
|
requirements:
|
227
|
-
- - ">="
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: 3.6.0
|
230
261
|
- - "~>"
|
231
262
|
- !ruby/object:Gem::Version
|
232
|
-
version: '3.
|
263
|
+
version: '3.12'
|
264
|
+
- - ">="
|
265
|
+
- !ruby/object:Gem::Version
|
266
|
+
version: 3.12.2
|
233
267
|
description: A simple library for communicating with the FinApps REST API. Core functionality.
|
234
268
|
email:
|
235
269
|
- erich@financialapps.com
|
@@ -240,8 +274,9 @@ extra_rdoc_files:
|
|
240
274
|
- LICENSE
|
241
275
|
files:
|
242
276
|
- ".codeclimate.yml"
|
277
|
+
- ".github/dependabot.yml"
|
243
278
|
- ".github/release-drafter.yml"
|
244
|
-
- ".github/workflows/
|
279
|
+
- ".github/workflows/ci.yaml"
|
245
280
|
- ".github/workflows/release-drafter.yml"
|
246
281
|
- ".github/workflows/release.yml"
|
247
282
|
- ".github/workflows/verify-pr-labeled.yml"
|
@@ -271,6 +306,7 @@ files:
|
|
271
306
|
- lib/finapps_core/middleware/request/tenant_authentication.rb
|
272
307
|
- lib/finapps_core/middleware/request/user_agent.rb
|
273
308
|
- lib/finapps_core/middleware/request/x_consumer_id.rb
|
309
|
+
- lib/finapps_core/middleware/request/x_tenant_id.rb
|
274
310
|
- lib/finapps_core/middleware/response/raise_error.rb
|
275
311
|
- lib/finapps_core/rest/base_client.rb
|
276
312
|
- lib/finapps_core/rest/configuration.rb
|
@@ -289,6 +325,7 @@ files:
|
|
289
325
|
- spec/middleware/request/tenant_authentication_spec.rb
|
290
326
|
- spec/middleware/request/user_agent_spec.rb
|
291
327
|
- spec/middleware/request/x_consumer_id_spec.rb
|
328
|
+
- spec/middleware/request/x_tenant_id_spec.rb
|
292
329
|
- spec/middleware/response/raise_error_spec.rb
|
293
330
|
- spec/rest/base_client_spec.rb
|
294
331
|
- spec/rest/configuration_spec.rb
|
@@ -330,25 +367,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
367
|
- !ruby/object:Gem::Version
|
331
368
|
version: '0'
|
332
369
|
requirements: []
|
333
|
-
rubygems_version: 3.
|
370
|
+
rubygems_version: 3.1.4
|
334
371
|
signing_key:
|
335
372
|
specification_version: 4
|
336
373
|
summary: FinApps REST API ruby client - Core.
|
337
374
|
test_files:
|
338
|
-
- spec/spec_helper.rb
|
339
|
-
- spec/support/fake_api.rb
|
340
|
-
- spec/utils/validatable_spec.rb
|
341
375
|
- spec/core_extensions/object/is_integer_spec.rb
|
342
|
-
- spec/
|
343
|
-
- spec/
|
344
|
-
- spec/rest/resources_spec.rb
|
345
|
-
- spec/rest/credentials_spec.rb
|
346
|
-
- spec/rest/configuration_spec.rb
|
376
|
+
- spec/support/fake_api.rb
|
377
|
+
- spec/spec_helper.rb
|
347
378
|
- spec/spec_helpers/client.rb
|
348
379
|
- spec/middleware/request/user_agent_spec.rb
|
349
|
-
- spec/middleware/request/tenant_authentication_spec.rb
|
350
380
|
- spec/middleware/request/x_consumer_id_spec.rb
|
381
|
+
- spec/middleware/request/accept_json_spec.rb
|
382
|
+
- spec/middleware/request/x_tenant_id_spec.rb
|
383
|
+
- spec/middleware/request/tenant_authentication_spec.rb
|
351
384
|
- spec/middleware/request/no_encoding_basic_authentication_spec.rb
|
352
385
|
- spec/middleware/request/request_id_spec.rb
|
353
|
-
- spec/middleware/request/accept_json_spec.rb
|
354
386
|
- spec/middleware/response/raise_error_spec.rb
|
387
|
+
- spec/utils/validatable_spec.rb
|
388
|
+
- spec/rest/configuration_spec.rb
|
389
|
+
- spec/rest/resources_spec.rb
|
390
|
+
- spec/rest/credentials_spec.rb
|
391
|
+
- spec/rest/defaults_spec.rb
|
392
|
+
- spec/rest/base_client_spec.rb
|
data/.github/workflows/main.yaml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
name: Continuous Integration
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
ci:
|
7
|
-
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
|
10
|
-
strategy:
|
11
|
-
fail-fast: true
|
12
|
-
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v1
|
15
|
-
|
16
|
-
- name: Use Ruby 2.6
|
17
|
-
uses: actions/setup-ruby@v1
|
18
|
-
with:
|
19
|
-
ruby-version: '2.6'
|
20
|
-
|
21
|
-
- uses: actions/cache@v2
|
22
|
-
with:
|
23
|
-
path: vendor/bundle
|
24
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
25
|
-
restore-keys: |
|
26
|
-
${{ runner.os }}-gems-
|
27
|
-
|
28
|
-
- name: Install gems
|
29
|
-
run: |
|
30
|
-
gem install -N bundler
|
31
|
-
bundle config path vendor/bundle
|
32
|
-
bundle install --jobs 4 --retry 3
|
33
|
-
|
34
|
-
- name: Run rubocop
|
35
|
-
run: bundle exec rubocop
|
36
|
-
|
37
|
-
- name: Run tests
|
38
|
-
run: bundle exec rspec
|