finapps_core 5.0.8 → 5.0.14
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/release-drafter.yml +49 -0
- data/.github/workflows/main.yaml +37 -0
- data/.github/workflows/release-drafter.yml +15 -0
- data/.github/workflows/release.yml +54 -0
- data/.github/workflows/verify-pr-labeled.yml +14 -0
- data/.rubocop.yml +7 -14
- data/.ruby-version +1 -1
- data/finapps_core.gemspec +8 -8
- 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/base_client.rb +3 -3
- data/lib/finapps_core/rest/configuration.rb +26 -8
- data/lib/finapps_core/rest/connection.rb +1 -0
- data/lib/finapps_core/utils/loggeable.rb +1 -1
- data/lib/finapps_core/version.rb +1 -1
- data/spec/middleware/request/x_tenant_id_spec.rb +16 -0
- data/spec/rest/base_client_spec.rb +2 -2
- data/spec/rest/configuration_spec.rb +37 -9
- data/spec/support/fake_api.rb +1 -1
- metadata +59 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a0b9d68f085e0831b039da71cd442e4c96d58f8e6cd9787c4b8ec4eef9edf8d
|
4
|
+
data.tar.gz: aacb0dc131db339c2360f38fa8918360bdcc2f5ada120e97b21cdd1c15a2daf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1487eb6356e82eccf6b8584b0a7074fb8af3ef893b74bbda50b1e4087fdb35132e84c8eb44801f376f504b44e6d80e7fcb1a45cdf4a8520c49ad08c148659d2d
|
7
|
+
data.tar.gz: 61838248219a84def621b1136da25ac25a93404a35cd67d8e2435e3ec16d84873862e52453293fa22f3c8cb73382e2ee5a259057c7b295207e0edaec31e1c724
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name-template: 'version $RESOLVED_VERSION'
|
2
|
+
tag-template: 'v$RESOLVED_VERSION'
|
3
|
+
categories:
|
4
|
+
- title: 'Added'
|
5
|
+
labels: 'enhancement'
|
6
|
+
- title: 'Changed'
|
7
|
+
labels: 'change'
|
8
|
+
- title: 'Deprecated'
|
9
|
+
labels: 'deprecated'
|
10
|
+
- title: 'Removed'
|
11
|
+
labels: 'removed'
|
12
|
+
- title: 'Fixed'
|
13
|
+
labels: 'bug'
|
14
|
+
- title: 'Security'
|
15
|
+
label: 'dependencies'
|
16
|
+
- title: 'Documentation updates'
|
17
|
+
label: 'documentation'
|
18
|
+
- title: 'Maintenance'
|
19
|
+
labels: 'internal'
|
20
|
+
|
21
|
+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
22
|
+
|
23
|
+
version-resolver:
|
24
|
+
major:
|
25
|
+
labels:
|
26
|
+
- 'major'
|
27
|
+
minor:
|
28
|
+
labels:
|
29
|
+
- 'minor'
|
30
|
+
patch:
|
31
|
+
labels:
|
32
|
+
- 'patch'
|
33
|
+
default: patch
|
34
|
+
|
35
|
+
exclude-labels:
|
36
|
+
- reverted
|
37
|
+
- no-changelog
|
38
|
+
- skip-changelog
|
39
|
+
- invalid
|
40
|
+
|
41
|
+
template: |
|
42
|
+
## [$RESOLVED_VERSION](https://github.com/finapps/ruby-client-core/compare/$PREVIOUS_TAG...$RESOLVED_VERSION)
|
43
|
+
$CHANGES
|
44
|
+
|
45
|
+
replacers:
|
46
|
+
- search: '/CVE-(\d{4})-(\d+)/g'
|
47
|
+
replace: 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-$1-$2'
|
48
|
+
- search: '@dependabot-preview'
|
49
|
+
replace: '@dependabot'
|
@@ -0,0 +1,37 @@
|
|
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
|
+
- name: Checkout source code
|
15
|
+
uses: actions/checkout@v2
|
16
|
+
|
17
|
+
- name: Install required ruby version
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
|
20
|
+
- uses: actions/cache@v2
|
21
|
+
with:
|
22
|
+
path: vendor/bundle
|
23
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
24
|
+
restore-keys: |
|
25
|
+
${{ runner.os }}-gems-
|
26
|
+
|
27
|
+
- name: Install gems
|
28
|
+
run: |
|
29
|
+
gem install -N bundler
|
30
|
+
bundle config path vendor/bundle
|
31
|
+
bundle install --jobs 4 --retry 3
|
32
|
+
|
33
|
+
- name: Run rubocop
|
34
|
+
run: bundle exec rubocop
|
35
|
+
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rspec
|
@@ -0,0 +1,15 @@
|
|
1
|
+
name: Release Drafter
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
update_release_draft:
|
10
|
+
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: release-drafter/release-drafter@v5
|
14
|
+
env:
|
15
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
name: Bump version and Release
|
2
|
+
on:
|
3
|
+
release:
|
4
|
+
types: [published]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
release:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
fail-fast: true
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- name: Checkout source code
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
persist-credentials: false
|
17
|
+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
18
|
+
|
19
|
+
- name: Install required ruby version
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
|
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
name: "Require PR labels"
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [opened, labeled, unlabeled, synchronize]
|
6
|
+
jobs:
|
7
|
+
label:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: mheap/github-action-required-labels@v1
|
11
|
+
with:
|
12
|
+
mode: exactly
|
13
|
+
count: 1
|
14
|
+
labels: "bug, change, enhancement"
|
data/.rubocop.yml
CHANGED
@@ -8,6 +8,7 @@ AllCops:
|
|
8
8
|
- "vendor/**/*"
|
9
9
|
- "bin/**/*"
|
10
10
|
CacheRootDirectory: tmp
|
11
|
+
NewCops: enable
|
11
12
|
|
12
13
|
Layout/SpaceAroundMethodCallOperator:
|
13
14
|
Enabled: true
|
@@ -45,10 +46,10 @@ Metrics/ClassLength:
|
|
45
46
|
- app/controllers/orders_controller.rb
|
46
47
|
- app/models/order.rb
|
47
48
|
Metrics/BlockLength:
|
48
|
-
|
49
|
+
IgnoredMethods: ['describe', 'context']
|
49
50
|
Exclude:
|
51
|
+
- finapps_core.gemspec
|
50
52
|
- config/environments/**/**
|
51
|
-
- '*.gemspec'
|
52
53
|
- Guardfile
|
53
54
|
- config/routes.rb
|
54
55
|
- config/Guardfile
|
@@ -68,6 +69,8 @@ Naming/PredicateName:
|
|
68
69
|
|
69
70
|
RSpec/FilePath:
|
70
71
|
Enabled: false
|
72
|
+
Gemspec/RequiredRubyVersion:
|
73
|
+
Enabled: false
|
71
74
|
|
72
75
|
Style/RedundantRegexpCharacterClass:
|
73
76
|
Enabled: true
|
@@ -137,18 +140,8 @@ Style/OneLineConditional:
|
|
137
140
|
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
138
141
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
139
142
|
Enabled: false
|
140
|
-
Style/
|
141
|
-
Enabled:
|
142
|
-
Style/HashEachMethods:
|
143
|
-
Enabled: true
|
144
|
-
Style/HashTransformKeys:
|
145
|
-
Enabled: true
|
146
|
-
Style/HashTransformValues:
|
147
|
-
Enabled: true
|
148
|
-
Style/RedundantFetchBlock:
|
149
|
-
Enabled: true
|
150
|
-
Style/SlicingWithRange:
|
151
|
-
Enabled: true
|
143
|
+
Style/OptionalBooleanParameter:
|
144
|
+
Enabled: false
|
152
145
|
|
153
146
|
RSpec/NestedGroups:
|
154
147
|
Max: 5
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.2
|
data/finapps_core.gemspec
CHANGED
@@ -20,17 +20,17 @@ 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', '~> 0
|
24
|
-
spec.add_runtime_dependency 'faraday_middleware', '~> 0
|
23
|
+
spec.add_runtime_dependency 'faraday', '~> 1.0', '>= 1.0.1'
|
24
|
+
spec.add_runtime_dependency 'faraday_middleware', '~> 1.0', '>= 1.0'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~> 2.0',
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
|
27
27
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
|
28
|
-
spec.add_development_dependency 'gem-release', '~> 2.0', '>= 2.0.3'
|
29
28
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
30
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
31
|
-
spec.add_development_dependency 'rubocop', '~>
|
32
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
33
|
-
spec.add_development_dependency 'rubocop-
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.10', '>= 3.10.0'
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 1.8', '>= 1.8.1'
|
31
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.9', '>= 1.9.2'
|
32
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5', '>= 0.5.1'
|
33
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.1', '>= 2.1.0'
|
34
34
|
spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.5'
|
35
35
|
spec.add_development_dependency 'webmock', '~> 3.6', '>= 3.6.0'
|
36
36
|
|
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
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './configuration
|
4
|
-
require_relative './connection
|
3
|
+
require_relative './configuration'
|
4
|
+
require_relative './connection'
|
5
5
|
require_relative '../utils/loggeable'
|
6
6
|
require_relative '../utils/validatable'
|
7
7
|
|
@@ -81,7 +81,7 @@ module FinAppsCore
|
|
81
81
|
[send(method, path, params), []]
|
82
82
|
rescue FinAppsCore::InvalidArgumentsError,
|
83
83
|
FinAppsCore::MissingArgumentsError,
|
84
|
-
Faraday::
|
84
|
+
Faraday::ConnectionFailed => e
|
85
85
|
[nil, handle_error(e)]
|
86
86
|
rescue Faraday::ClientError => e
|
87
87
|
[nil, handle_client_error(e)]
|
@@ -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
|
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
|
@@ -29,9 +29,9 @@ RSpec.describe FinAppsCore::REST::BaseClient do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#send_request' do
|
32
|
-
it 'raises
|
32
|
+
it 'raises NoMethodError if method is NOT supported' do
|
33
33
|
expect { base_client.send_request('fake_path', :option) }
|
34
|
-
.to(raise_error
|
34
|
+
.to(raise_error(NoMethodError, /undefined method `option/))
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'raises FinAppsCore::MissingArgumentsError if method is NOT provided' do
|
@@ -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/support/fake_api.rb
CHANGED
@@ -34,7 +34,7 @@ class FakeApi < Sinatra::Base
|
|
34
34
|
def json_response(response_code, file_name)
|
35
35
|
content_type :json
|
36
36
|
status response_code
|
37
|
-
File.open(File.dirname(__FILE__)
|
37
|
+
File.open("#{File.dirname(__FILE__)}/fixtures/#{file_name}", 'rb').read
|
38
38
|
end
|
39
39
|
|
40
40
|
def version; end
|
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: 5.0.
|
4
|
+
version: 5.0.14
|
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-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,40 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '1.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 1.0.1
|
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: '0
|
29
|
+
version: '1.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 1.0.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: faraday_middleware
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0
|
39
|
+
version: '1.0'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0
|
42
|
+
version: '1.0'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0
|
49
|
+
version: '1.0'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0
|
52
|
+
version: '1.0'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: bundler
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,125 +91,125 @@ dependencies:
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 1.0.9
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: rake
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '13.0'
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 13.0.1
|
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: '13.0'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 13.0.1
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
114
|
+
name: rspec
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '
|
119
|
+
version: '3.10'
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: 3.10.0
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '
|
129
|
+
version: '3.10'
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 3.10.0
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
|
-
name:
|
134
|
+
name: rubocop
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
139
|
+
version: '1.8'
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
142
|
+
version: 1.8.1
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - "~>"
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: '
|
149
|
+
version: '1.8'
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 1.8.1
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop
|
154
|
+
name: rubocop-performance
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '1.9'
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
162
|
+
version: 1.9.2
|
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: '1.9'
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
172
|
+
version: 1.9.2
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name: rubocop-
|
174
|
+
name: rubocop-rake
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
179
|
+
version: '0.5'
|
180
180
|
- - ">="
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
182
|
+
version: 0.5.1
|
183
183
|
type: :development
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
189
|
+
version: '0.5'
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
192
|
+
version: 0.5.1
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: rubocop-rspec
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
197
|
- - "~>"
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: '1
|
199
|
+
version: '2.1'
|
200
200
|
- - ">="
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version: 1.
|
202
|
+
version: 2.1.0
|
203
203
|
type: :development
|
204
204
|
prerelease: false
|
205
205
|
version_requirements: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - "~>"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: '1
|
209
|
+
version: '2.1'
|
210
210
|
- - ">="
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version: 1.
|
212
|
+
version: 2.1.0
|
213
213
|
- !ruby/object:Gem::Dependency
|
214
214
|
name: sinatra
|
215
215
|
requirement: !ruby/object:Gem::Requirement
|
@@ -260,6 +260,11 @@ extra_rdoc_files:
|
|
260
260
|
- LICENSE
|
261
261
|
files:
|
262
262
|
- ".codeclimate.yml"
|
263
|
+
- ".github/release-drafter.yml"
|
264
|
+
- ".github/workflows/main.yaml"
|
265
|
+
- ".github/workflows/release-drafter.yml"
|
266
|
+
- ".github/workflows/release.yml"
|
267
|
+
- ".github/workflows/verify-pr-labeled.yml"
|
263
268
|
- ".gitignore"
|
264
269
|
- ".gitlab-ci.yml"
|
265
270
|
- ".hound.yml"
|
@@ -286,6 +291,7 @@ files:
|
|
286
291
|
- lib/finapps_core/middleware/request/tenant_authentication.rb
|
287
292
|
- lib/finapps_core/middleware/request/user_agent.rb
|
288
293
|
- lib/finapps_core/middleware/request/x_consumer_id.rb
|
294
|
+
- lib/finapps_core/middleware/request/x_tenant_id.rb
|
289
295
|
- lib/finapps_core/middleware/response/raise_error.rb
|
290
296
|
- lib/finapps_core/rest/base_client.rb
|
291
297
|
- lib/finapps_core/rest/configuration.rb
|
@@ -304,6 +310,7 @@ files:
|
|
304
310
|
- spec/middleware/request/tenant_authentication_spec.rb
|
305
311
|
- spec/middleware/request/user_agent_spec.rb
|
306
312
|
- spec/middleware/request/x_consumer_id_spec.rb
|
313
|
+
- spec/middleware/request/x_tenant_id_spec.rb
|
307
314
|
- spec/middleware/response/raise_error_spec.rb
|
308
315
|
- spec/rest/base_client_spec.rb
|
309
316
|
- spec/rest/configuration_spec.rb
|
@@ -345,25 +352,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
352
|
- !ruby/object:Gem::Version
|
346
353
|
version: '0'
|
347
354
|
requirements: []
|
348
|
-
rubygems_version: 3.1.
|
355
|
+
rubygems_version: 3.1.4
|
349
356
|
signing_key:
|
350
357
|
specification_version: 4
|
351
358
|
summary: FinApps REST API ruby client - Core.
|
352
359
|
test_files:
|
353
|
-
- spec/middleware/response/raise_error_spec.rb
|
354
|
-
- spec/middleware/request/user_agent_spec.rb
|
355
|
-
- spec/middleware/request/request_id_spec.rb
|
356
|
-
- spec/middleware/request/tenant_authentication_spec.rb
|
357
|
-
- spec/middleware/request/accept_json_spec.rb
|
358
|
-
- spec/middleware/request/x_consumer_id_spec.rb
|
359
|
-
- spec/middleware/request/no_encoding_basic_authentication_spec.rb
|
360
|
-
- spec/spec_helper.rb
|
361
360
|
- spec/spec_helpers/client.rb
|
361
|
+
- spec/spec_helper.rb
|
362
|
+
- spec/core_extensions/object/is_integer_spec.rb
|
362
363
|
- spec/utils/validatable_spec.rb
|
363
364
|
- spec/support/fake_api.rb
|
364
|
-
- spec/
|
365
|
+
- spec/middleware/request/no_encoding_basic_authentication_spec.rb
|
366
|
+
- spec/middleware/request/x_tenant_id_spec.rb
|
367
|
+
- spec/middleware/request/tenant_authentication_spec.rb
|
368
|
+
- spec/middleware/request/accept_json_spec.rb
|
369
|
+
- spec/middleware/request/user_agent_spec.rb
|
370
|
+
- spec/middleware/request/x_consumer_id_spec.rb
|
371
|
+
- spec/middleware/request/request_id_spec.rb
|
372
|
+
- spec/middleware/response/raise_error_spec.rb
|
365
373
|
- spec/rest/credentials_spec.rb
|
366
|
-
- spec/rest/base_client_spec.rb
|
367
|
-
- spec/rest/configuration_spec.rb
|
368
374
|
- spec/rest/defaults_spec.rb
|
375
|
+
- spec/rest/configuration_spec.rb
|
369
376
|
- spec/rest/resources_spec.rb
|
377
|
+
- spec/rest/base_client_spec.rb
|