finapps_core 5.0.6 → 5.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +4 -1
- data/.github/release-drafter.yml +49 -0
- data/.github/workflows/main.yaml +38 -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 +123 -73
- data/.tmuxinator.yml +20 -0
- data/.travis.yml +5 -6
- data/RELEASES.md +8 -0
- data/finapps_core.gemspec +9 -10
- data/lib/finapps_core.rb +1 -0
- data/lib/finapps_core/middleware/middleware.rb +7 -3
- data/lib/finapps_core/middleware/request/accept_json.rb +2 -1
- data/lib/finapps_core/middleware/request/user_agent.rb +1 -1
- data/lib/finapps_core/middleware/request/x_consumer_id.rb +20 -0
- data/lib/finapps_core/middleware/response/raise_error.rb +36 -7
- data/lib/finapps_core/rest/base_client.rb +20 -32
- data/lib/finapps_core/rest/configuration.rb +17 -4
- data/lib/finapps_core/rest/connection.rb +31 -21
- data/lib/finapps_core/rest/defaults.rb +1 -1
- data/lib/finapps_core/utils/loggeable.rb +1 -1
- data/lib/finapps_core/utils/validatable.rb +1 -1
- data/lib/finapps_core/version.rb +1 -1
- data/spec/core_extensions/object/is_integer_spec.rb +6 -7
- data/spec/middleware/request/accept_json_spec.rb +7 -3
- data/spec/middleware/request/no_encoding_basic_authentication_spec.rb +15 -6
- data/spec/middleware/request/request_id_spec.rb +4 -4
- data/spec/middleware/request/tenant_authentication_spec.rb +21 -14
- data/spec/middleware/request/user_agent_spec.rb +8 -3
- data/spec/middleware/request/x_consumer_id_spec.rb +16 -0
- data/spec/middleware/response/raise_error_spec.rb +47 -15
- data/spec/rest/base_client_spec.rb +87 -43
- data/spec/rest/configuration_spec.rb +25 -18
- data/spec/rest/credentials_spec.rb +4 -4
- data/spec/rest/defaults_spec.rb +1 -1
- data/spec/rest/resources_spec.rb +10 -20
- data/spec/spec_helper.rb +3 -3
- data/spec/support/fake_api.rb +1 -1
- data/spec/utils/validatable_spec.rb +9 -8
- metadata +73 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dd4de0991c1e8755d433dab8dc0dc424f3ea91f96397ab34989afdc662dc01cc
|
4
|
+
data.tar.gz: 6755974411e0bc978871969f6ce994013e2317c28fe0e18cce96a3b615673a0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5d459507dd0de21b728fbee60427007ed59243f2b2d98e6ea9c196ed605a363d91b24f752a76ffe1bbf10c34c9ae439985bf91f41bfdc7f0a523dd219d45c6b
|
7
|
+
data.tar.gz: 9b3c7d10e5dbb30c1f8fcc31e66975b01fcb5296045af520aae8bd869f52a89514697a99df2627b7cb456e07f4d69b70479b65171b5ca070942d0386e91fbc50
|
data/.codeclimate.yml
CHANGED
@@ -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/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,38 @@
|
|
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
|
@@ -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
|
+
- uses: actions/checkout@master
|
14
|
+
with:
|
15
|
+
persist-credentials: false
|
16
|
+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
|
17
|
+
|
18
|
+
- uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: '2.6'
|
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
@@ -1,24 +1,81 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-performance
|
4
|
+
|
1
5
|
AllCops:
|
2
|
-
|
6
|
+
TargetRubyVersion: 2.6
|
3
7
|
Exclude:
|
4
|
-
- "
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Metrics/LineLength:
|
9
|
-
Max: 120
|
10
|
-
|
11
|
-
# Re-enable this when the following is resolved:
|
12
|
-
# https://github.com/rubocop-hq/rubocop/issues/5953
|
13
|
-
Style/AccessModifierDeclarations:
|
14
|
-
Enabled: false
|
8
|
+
- "vendor/**/*"
|
9
|
+
- "bin/**/*"
|
10
|
+
CacheRootDirectory: tmp
|
11
|
+
NewCops: enable
|
15
12
|
|
13
|
+
Layout/SpaceAroundMethodCallOperator:
|
14
|
+
Enabled: true
|
15
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
16
|
+
Enabled: true
|
16
17
|
Layout/SpaceInsideBlockBraces:
|
17
18
|
# The space here provides no real gain in readability while consuming
|
18
19
|
# horizontal space that could be used for a better parameter name.
|
19
20
|
# Also {| differentiates better from a hash than { | does.
|
20
21
|
SpaceBeforeBlockParameters: false
|
22
|
+
Layout/SpaceInsideHashLiteralBraces:
|
23
|
+
EnforcedStyle: no_space
|
24
|
+
Layout/DotPosition:
|
25
|
+
Description: Checks the position of the dot in multi-line method calls.
|
26
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
27
|
+
Enabled: true
|
28
|
+
EnforcedStyle: leading
|
29
|
+
SupportedStyles:
|
30
|
+
- leading
|
31
|
+
- trailing
|
32
|
+
Layout/LineLength:
|
33
|
+
Max: 110
|
34
|
+
|
35
|
+
Lint/DeprecatedOpenSSLConstant:
|
36
|
+
Enabled: true
|
37
|
+
Lint/MixedRegexpCaptureTypes:
|
38
|
+
Enabled: true
|
39
|
+
Lint/RaiseException:
|
40
|
+
Enabled: true
|
41
|
+
Lint/StructNewOverride:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Metrics/ClassLength:
|
45
|
+
Exclude:
|
46
|
+
- app/controllers/orders_controller.rb
|
47
|
+
- app/models/order.rb
|
48
|
+
Metrics/BlockLength:
|
49
|
+
ExcludedMethods: ['describe', 'context']
|
50
|
+
Exclude:
|
51
|
+
- finapps_core.gemspec
|
52
|
+
- config/environments/**/**
|
53
|
+
- Guardfile
|
54
|
+
- config/routes.rb
|
55
|
+
- config/Guardfile
|
21
56
|
|
57
|
+
Naming/PredicateName:
|
58
|
+
Description: Check the names of predicate methods.
|
59
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
60
|
+
Enabled: true
|
61
|
+
NamePrefix:
|
62
|
+
- is_
|
63
|
+
- has_
|
64
|
+
- have_
|
65
|
+
ForbiddenPrefixes:
|
66
|
+
- is_
|
67
|
+
Exclude:
|
68
|
+
- spec/**/*
|
69
|
+
|
70
|
+
RSpec/FilePath:
|
71
|
+
Enabled: false
|
72
|
+
Gemspec/RequiredRubyVersion:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/RedundantRegexpCharacterClass:
|
76
|
+
Enabled: true
|
77
|
+
Style/RedundantRegexpEscape:
|
78
|
+
Enabled: true
|
22
79
|
Style/CollectionMethods:
|
23
80
|
Description: Preferred collection methods.
|
24
81
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
|
@@ -29,73 +86,66 @@ Style/CollectionMethods:
|
|
29
86
|
find: detect
|
30
87
|
find_all: select
|
31
88
|
reduce: inject
|
89
|
+
Style/GuardClause:
|
90
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
91
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
92
|
+
Enabled: true
|
93
|
+
MinBodyLength: 1
|
32
94
|
Style/OptionHash:
|
33
95
|
Description: Don't use option hashes when you can use keyword arguments.
|
34
96
|
Enabled: false
|
35
|
-
|
36
|
-
Description:
|
37
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#
|
38
|
-
Enabled: true
|
39
|
-
NamePrefix:
|
40
|
-
- is_
|
41
|
-
- has_
|
42
|
-
- have_
|
43
|
-
NamePrefixBlacklist:
|
44
|
-
- is_
|
45
|
-
Exclude:
|
46
|
-
- spec/**/*
|
47
|
-
Metrics/AbcSize:
|
48
|
-
Description: A calculated magnitude based on number of assignments, branches, and
|
49
|
-
conditions.
|
50
|
-
Enabled: false
|
51
|
-
Max: 15
|
52
|
-
Metrics/BlockLength:
|
53
|
-
ExcludedMethods: ['describe', 'context']
|
54
|
-
Metrics/ClassLength:
|
55
|
-
Description: Avoid classes longer than 100 lines of code.
|
56
|
-
Enabled: false
|
57
|
-
CountComments: false
|
58
|
-
Max: 100
|
59
|
-
Metrics/ModuleLength:
|
60
|
-
CountComments: false
|
61
|
-
Max: 100
|
62
|
-
Description: Avoid modules longer than 100 lines of code.
|
63
|
-
Enabled: false
|
64
|
-
Metrics/CyclomaticComplexity:
|
65
|
-
Description: A complexity metric that is strongly correlated to the number of test
|
66
|
-
cases needed to validate a method.
|
67
|
-
Enabled: false
|
68
|
-
Max: 6
|
69
|
-
Metrics/MethodLength:
|
70
|
-
Description: Avoid methods longer than 10 lines of code.
|
71
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
72
|
-
Enabled: false
|
73
|
-
CountComments: false
|
74
|
-
Max: 10
|
75
|
-
Metrics/ParameterLists:
|
76
|
-
Description: Avoid parameter lists longer than three or four parameters.
|
77
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
78
|
-
Enabled: false
|
79
|
-
Max: 5
|
80
|
-
CountKeywordArgs: true
|
81
|
-
Metrics/PerceivedComplexity:
|
82
|
-
Description: A complexity metric geared towards measuring complexity for a human
|
83
|
-
reader.
|
97
|
+
Style/PercentLiteralDelimiters:
|
98
|
+
Description: Use `%`-literal delimiters consistently
|
99
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
84
100
|
Enabled: false
|
85
|
-
|
101
|
+
PreferredDelimiters:
|
102
|
+
"%": "()"
|
103
|
+
"%i": "()"
|
104
|
+
"%q": "()"
|
105
|
+
"%Q": "()"
|
106
|
+
"%r": "{}"
|
107
|
+
"%s": "()"
|
108
|
+
"%w": "()"
|
109
|
+
"%W": "()"
|
110
|
+
"%x": "()"
|
111
|
+
Style/SignalException:
|
112
|
+
Description: Checks for proper usage of fail and raise.
|
113
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
114
|
+
Enabled: true
|
115
|
+
EnforcedStyle: semantic
|
116
|
+
SupportedStyles:
|
117
|
+
- only_raise
|
118
|
+
- only_fail
|
119
|
+
- semantic
|
120
|
+
Style/StringLiterals:
|
121
|
+
Description: Checks if uses of quotes match the configured preference.
|
122
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
|
123
|
+
Enabled: true
|
124
|
+
EnforcedStyle: single_quotes
|
125
|
+
SupportedStyles:
|
126
|
+
- single_quotes
|
127
|
+
- double_quotes
|
128
|
+
Style/StringLiteralsInInterpolation:
|
129
|
+
Description: Checks if uses of quotes inside expressions in interpolated strings
|
130
|
+
match the configured preference.
|
131
|
+
Enabled: true
|
132
|
+
EnforcedStyle: single_quotes
|
133
|
+
SupportedStyles:
|
134
|
+
- single_quotes
|
135
|
+
- double_quotes
|
86
136
|
Style/Documentation:
|
87
137
|
Description: Document classes and non-namespace modules.
|
88
138
|
Enabled: false
|
89
|
-
Style/
|
90
|
-
Description:
|
91
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#
|
139
|
+
Style/OneLineConditional:
|
140
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
141
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
92
142
|
Enabled: false
|
93
|
-
Style/
|
94
|
-
Description: Don't interpolate global, instance and class variables directly in
|
95
|
-
strings.
|
96
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
|
143
|
+
Style/OptionalBooleanParameter:
|
97
144
|
Enabled: false
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
145
|
+
|
146
|
+
RSpec/NestedGroups:
|
147
|
+
Max: 5
|
148
|
+
RSpec/DescribeClass:
|
149
|
+
Exclude:
|
150
|
+
- spec/system/*
|
151
|
+
- spec/factories_spec.rb
|
data/.tmuxinator.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: ruby-client-core
|
3
|
+
root: ~/projects/ruby-client-core/
|
4
|
+
windows:
|
5
|
+
-
|
6
|
+
editor:
|
7
|
+
layout: main-vertical
|
8
|
+
panes:
|
9
|
+
- vim: $EDITOR
|
10
|
+
- bash:
|
11
|
+
- git pull
|
12
|
+
- git status
|
13
|
+
- bundle
|
14
|
+
- bundle outdated
|
15
|
+
-
|
16
|
+
guard:
|
17
|
+
layout: even-horizontal
|
18
|
+
panes:
|
19
|
+
- guard:
|
20
|
+
- bundle exec guard
|
data/.travis.yml
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
2
|
+
os: ["linux"]
|
3
|
+
dist: "xenial"
|
4
|
+
|
3
5
|
cache:
|
4
6
|
bundler: true
|
5
7
|
|
6
8
|
rvm:
|
7
|
-
- 2.5
|
8
9
|
- 2.6
|
9
|
-
- ruby-head
|
10
10
|
|
11
11
|
before_install:
|
12
12
|
- "echo 'gem: --no-document' > ~/.gemrc"
|
13
|
-
- gem
|
14
|
-
- gem install bundler -v "~>2.0"
|
13
|
+
- gem install bundler --force --quiet
|
15
14
|
|
16
15
|
script:
|
17
16
|
- bundle exec rspec
|
@@ -23,4 +22,4 @@ addons:
|
|
23
22
|
code_climate:
|
24
23
|
repo_token: 5a8d194cbc23aa4c171e3478e3b6bbea9dd96041071380ec25bf80c07770b39a
|
25
24
|
after_success:
|
26
|
-
- bundle exec codeclimate-test-reporter
|
25
|
+
- bundle exec codeclimate-test-reporter
|