finapps_core 5.0.10 → 5.0.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7430c005b154f12216d5ea8075681c9ff616a783e1b4706c339531e1a821aa95
4
- data.tar.gz: 0edaf97a7ab75208c30944d75243bab93471b249b99aeeed86a51f2025e3f6a9
3
+ metadata.gz: efedc04912fc8d2e17cdf0bdc23dc97a5635176edfe159c14c501fe78324bfe4
4
+ data.tar.gz: 86a3f2c2780f971838604f94f53e81b3835ef4c7efb8012919750e17adfb9c7c
5
5
  SHA512:
6
- metadata.gz: 769493f4d4bc686430d96dd960daf52383e2d8eea8a4b9ed7a36bcb9151d3ff201f8e8f0611947b71e970fc6f8e0cce822009c8c295f1ee418885c7c2ebf31e7
7
- data.tar.gz: ef666e527b1e772180f0586ec5d7ba9250fed366c8e539e73735337a8e1f16238ecd270cd5547401e7c30fdfd59c7a6dad70433452eb769dab2d55473dff7198
6
+ metadata.gz: 1c9adf724d9ed849f72214bcfdbdcb14b92ee12e41192653f951fa26294cec1b1bcc72e57e473cafa051260faad28d3d64a90875c557bd02a1c66c407164fc7e
7
+ data.tar.gz: 4e2aba080939fc41f278285a379962d02c67a38017919ed851df50175b805826f745ace7eb05a0102682a0e14dc03b357d62f2df57f2893de4f2555475b43510
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
@@ -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,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
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/
@@ -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,23 @@
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: minimum
13
+ count: 1
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
@@ -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
- ExcludedMethods: ['describe', 'context']
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/ExponentialNotation:
141
- Enabled: true
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.6.3
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,19 +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.0', '>= 1.0.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.0', '>= 2.0.2'
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'
26
+ spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.16'
29
27
  spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
30
- spec.add_development_dependency 'rspec', '~> 3.8', '>= 3.8.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.86', '>= 0.86.0'
32
- spec.add_development_dependency 'rubocop-performance', '~> 1.6', '>= 1.6.1'
33
- spec.add_development_dependency 'rubocop-rspec', '~> 1.40', '>= 1.40.0'
34
- spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.5'
35
- spec.add_development_dependency 'webmock', '~> 3.6', '>= 3.6.0'
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'
36
37
 
37
38
  spec.extra_rdoc_files = %w(README.md LICENSE)
38
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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './configuration.rb'
4
- require_relative './connection.rb'
3
+ require_relative './configuration'
4
+ require_relative './connection'
5
5
  require_relative '../utils/loggeable'
6
6
  require_relative '../utils/validatable'
7
7
 
@@ -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.merge(remove_empty_options(options))
15
- .each {|key, value| public_send("#{key}=", value) }
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
@@ -9,7 +9,7 @@ module FinAppsCore
9
9
 
10
10
  # noinspection SpellCheckingInspection
11
11
  DEFAULTS = {
12
- host: 'https://api.finclear.io',
12
+ host: 'https://api.allcleardecisioning.com',
13
13
  timeout: 30,
14
14
  proxy: nil,
15
15
  log_level: Logger::UNKNOWN
@@ -7,7 +7,7 @@ module FinAppsCore
7
7
  def logger
8
8
  @logger ||= begin
9
9
  require 'logger'
10
- logger = Logger.new(STDOUT)
10
+ logger = Logger.new($stdout)
11
11
  logger.level = FinAppsCore::REST::Defaults::DEFAULTS[:log_level]
12
12
  logger
13
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinAppsCore
4
- VERSION = '5.0.10'
4
+ VERSION = '5.0.16'
5
5
  end
@@ -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: 'whatever') }
12
+ subject(:configuration) { described_class.new(timeout: 'foo') }
9
13
 
10
- expected_error = FinAppsCore::InvalidArgumentsError
11
- it { expect { configuration }.to raise_error(expected_error, 'Invalid argument. {timeout: whatever}') }
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(FinAppsCore::REST::Defaults::DEFAULTS[:timeout])
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: 'whatever') }
29
+ subject(:configuration) { described_class.new(host: 'foo') }
24
30
 
25
- expected_error = FinAppsCore::InvalidArgumentsError
26
- it { expect { configuration }.to raise_error(expected_error, 'Invalid argument. {host: whatever}') }
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(FinAppsCore::REST::Defaults::DEFAULTS[:host])
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) { described_class.new(user_identifier: 1, user_token: 2) }
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
@@ -9,9 +9,22 @@ RSpec.describe FinAppsCore::REST::Defaults do
9
9
  it('sets API_VERSION') { expect(described_class::API_VERSION).to eq '4' }
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
- it('sets DEFAULTS[:host]') { expect(described_class::DEFAULTS[:host]).to eq 'https://api.finclear.io' }
13
- it('sets DEFAULTS[:timeout]') { expect(described_class::DEFAULTS[:timeout]).to eq 30 }
14
- it('does not set DEFAULTS[:proxy]') { expect(described_class::DEFAULTS[:proxy]).to be_nil }
15
- it('sets DEFAULTS[:log_level]') { expect(described_class::DEFAULTS[:log_level]).to eq Logger::UNKNOWN }
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['CODECLIMATE_REPO_TOKEN']
4
- # require 'codeclimate-test-reporter'
5
- # CodeClimate::TestReporter.start
3
+ if ENV['COVERAGE'] == 'true'
6
4
  require 'simplecov'
7
- SimpleCov.start
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',
@@ -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__) + '/fixtures/' + file_name, 'rb').read
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.10
4
+ version: 5.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2021-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.4'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.1
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.0'
29
+ version: '1.4'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.0.1
32
+ version: 1.4.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday_middleware
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '1.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '1.0'
42
+ version: 1.0.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,207 +49,221 @@ dependencies:
49
49
  version: '1.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: '1.0'
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.0'
59
+ version: '2.2'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 2.0.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.0'
69
+ version: '2.2'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 2.0.2
72
+ version: 2.2.16
73
73
  - !ruby/object:Gem::Dependency
74
- name: codeclimate-test-reporter
74
+ name: rake
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '1.0'
79
+ version: '13.0'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.9
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: '1.0'
89
+ version: '13.0'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 1.0.9
92
+ version: 13.0.1
93
93
  - !ruby/object:Gem::Dependency
94
- name: gem-release
94
+ name: rspec
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '2.0'
99
+ version: '3.10'
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 2.0.3
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: '2.0'
109
+ version: '3.10'
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 2.0.3
112
+ version: 3.10.0
113
113
  - !ruby/object:Gem::Dependency
114
- name: rake
114
+ name: rubocop
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '13.0'
119
+ version: '1.9'
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 13.0.1
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
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '13.0'
129
+ version: '1.9'
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 13.0.1
132
+ version: 1.9.1
133
133
  - !ruby/object:Gem::Dependency
134
- name: rspec
134
+ name: rubocop-performance
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '3.8'
139
+ version: '1.9'
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- version: 3.8.0
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
147
  - - "~>"
148
148
  - !ruby/object:Gem::Version
149
- version: '3.8'
149
+ version: '1.9'
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 3.8.0
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: '0.86'
159
+ version: '0.5'
160
160
  - - ">="
161
161
  - !ruby/object:Gem::Version
162
- version: 0.86.0
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: '0.86'
169
+ version: '0.5'
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
- version: 0.86.0
172
+ version: 0.5.1
173
173
  - !ruby/object:Gem::Dependency
174
- name: rubocop-performance
174
+ name: rubocop-rspec
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '1.6'
179
+ version: '2.2'
180
180
  - - ">="
181
181
  - !ruby/object:Gem::Version
182
- version: 1.6.1
182
+ version: 2.2.0
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: '1.6'
189
+ version: '2.2'
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
- version: 1.6.1
192
+ version: 2.2.0
193
193
  - !ruby/object:Gem::Dependency
194
- name: rubocop-rspec
194
+ name: simplecov
195
195
  requirement: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '1.40'
199
+ version: '0.21'
200
200
  - - ">="
201
201
  - !ruby/object:Gem::Version
202
- version: 1.40.0
202
+ version: 0.21.2
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.40'
209
+ version: '0.21'
210
210
  - - ">="
211
211
  - !ruby/object:Gem::Version
212
- version: 1.40.0
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:
224
+ - - "~>"
225
+ - !ruby/object:Gem::Version
226
+ version: '0.9'
213
227
  - !ruby/object:Gem::Dependency
214
228
  name: sinatra
215
229
  requirement: !ruby/object:Gem::Requirement
216
230
  requirements:
217
231
  - - "~>"
218
232
  - !ruby/object:Gem::Version
219
- version: '2.0'
233
+ version: '2.1'
220
234
  - - ">="
221
235
  - !ruby/object:Gem::Version
222
- version: 2.0.5
236
+ version: 2.1.0
223
237
  type: :development
224
238
  prerelease: false
225
239
  version_requirements: !ruby/object:Gem::Requirement
226
240
  requirements:
227
241
  - - "~>"
228
242
  - !ruby/object:Gem::Version
229
- version: '2.0'
243
+ version: '2.1'
230
244
  - - ">="
231
245
  - !ruby/object:Gem::Version
232
- version: 2.0.5
246
+ version: 2.1.0
233
247
  - !ruby/object:Gem::Dependency
234
248
  name: webmock
235
249
  requirement: !ruby/object:Gem::Requirement
236
250
  requirements:
237
251
  - - "~>"
238
252
  - !ruby/object:Gem::Version
239
- version: '3.6'
253
+ version: '3.12'
240
254
  - - ">="
241
255
  - !ruby/object:Gem::Version
242
- version: 3.6.0
256
+ version: 3.12.2
243
257
  type: :development
244
258
  prerelease: false
245
259
  version_requirements: !ruby/object:Gem::Requirement
246
260
  requirements:
247
261
  - - "~>"
248
262
  - !ruby/object:Gem::Version
249
- version: '3.6'
263
+ version: '3.12'
250
264
  - - ">="
251
265
  - !ruby/object:Gem::Version
252
- version: 3.6.0
266
+ version: 3.12.2
253
267
  description: A simple library for communicating with the FinApps REST API. Core functionality.
254
268
  email:
255
269
  - erich@financialapps.com
@@ -260,6 +274,12 @@ extra_rdoc_files:
260
274
  - LICENSE
261
275
  files:
262
276
  - ".codeclimate.yml"
277
+ - ".github/dependabot.yml"
278
+ - ".github/release-drafter.yml"
279
+ - ".github/workflows/ci.yaml"
280
+ - ".github/workflows/release-drafter.yml"
281
+ - ".github/workflows/release.yml"
282
+ - ".github/workflows/verify-pr-labeled.yml"
263
283
  - ".gitignore"
264
284
  - ".gitlab-ci.yml"
265
285
  - ".hound.yml"
@@ -286,6 +306,7 @@ files:
286
306
  - lib/finapps_core/middleware/request/tenant_authentication.rb
287
307
  - lib/finapps_core/middleware/request/user_agent.rb
288
308
  - lib/finapps_core/middleware/request/x_consumer_id.rb
309
+ - lib/finapps_core/middleware/request/x_tenant_id.rb
289
310
  - lib/finapps_core/middleware/response/raise_error.rb
290
311
  - lib/finapps_core/rest/base_client.rb
291
312
  - lib/finapps_core/rest/configuration.rb
@@ -304,6 +325,7 @@ files:
304
325
  - spec/middleware/request/tenant_authentication_spec.rb
305
326
  - spec/middleware/request/user_agent_spec.rb
306
327
  - spec/middleware/request/x_consumer_id_spec.rb
328
+ - spec/middleware/request/x_tenant_id_spec.rb
307
329
  - spec/middleware/response/raise_error_spec.rb
308
330
  - spec/rest/base_client_spec.rb
309
331
  - spec/rest/configuration_spec.rb
@@ -345,25 +367,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
367
  - !ruby/object:Gem::Version
346
368
  version: '0'
347
369
  requirements: []
348
- rubygems_version: 3.1.3
370
+ rubygems_version: 3.1.4
349
371
  signing_key:
350
372
  specification_version: 4
351
373
  summary: FinApps REST API ruby client - Core.
352
374
  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
- - spec/spec_helpers/client.rb
362
375
  - spec/utils/validatable_spec.rb
376
+ - spec/spec_helper.rb
363
377
  - spec/support/fake_api.rb
364
- - spec/core_extensions/object/is_integer_spec.rb
378
+ - spec/spec_helpers/client.rb
379
+ - spec/rest/resources_spec.rb
365
380
  - spec/rest/credentials_spec.rb
366
381
  - spec/rest/base_client_spec.rb
367
382
  - spec/rest/configuration_spec.rb
368
383
  - spec/rest/defaults_spec.rb
369
- - spec/rest/resources_spec.rb
384
+ - spec/core_extensions/object/is_integer_spec.rb
385
+ - spec/middleware/request/user_agent_spec.rb
386
+ - spec/middleware/request/request_id_spec.rb
387
+ - spec/middleware/request/accept_json_spec.rb
388
+ - spec/middleware/request/no_encoding_basic_authentication_spec.rb
389
+ - spec/middleware/request/tenant_authentication_spec.rb
390
+ - spec/middleware/request/x_consumer_id_spec.rb
391
+ - spec/middleware/request/x_tenant_id_spec.rb
392
+ - spec/middleware/response/raise_error_spec.rb