finapps_core 5.0.7 → 5.0.13
Sign up to get free protection for your applications and to get access to all the features.
- 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 +123 -73
- data/.ruby-version +1 -1
- data/.tmuxinator.yml +20 -0
- data/.travis.yml +5 -6
- data/finapps_core.gemspec +11 -11
- data/lib/finapps_core.rb +1 -0
- data/lib/finapps_core/middleware/middleware.rb +6 -3
- data/lib/finapps_core/middleware/request/accept_json.rb +2 -1
- data/lib/finapps_core/middleware/request/x_tenant_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 +18 -5
- data/lib/finapps_core/rest/connection.rb +32 -22
- 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 +4 -4
- data/spec/middleware/request/x_tenant_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 +78 -69
@@ -3,19 +3,19 @@
|
|
3
3
|
RSpec.describe FinAppsCore::REST::Credentials do
|
4
4
|
describe '#valid?' do
|
5
5
|
context 'when missing identifier' do
|
6
|
-
it { expect(
|
6
|
+
it { expect(described_class.new(nil, :token).valid?).to be(true) }
|
7
7
|
end
|
8
8
|
|
9
9
|
context 'when missing token' do
|
10
|
-
it { expect(
|
10
|
+
it { expect(described_class.new(:identifier, nil).valid?).to be(false) }
|
11
11
|
end
|
12
12
|
|
13
13
|
context 'when missing both identifier and token' do
|
14
|
-
it { expect(
|
14
|
+
it { expect(described_class.new(nil, nil).valid?).to be(false) }
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'when having identifier and token' do
|
18
|
-
it { expect(
|
18
|
+
it { expect(described_class.new(:identifier, :token).valid?).to be(true) }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/spec/rest/defaults_spec.rb
CHANGED
@@ -12,6 +12,6 @@ RSpec.describe FinAppsCore::REST::Defaults do
|
|
12
12
|
it('sets DEFAULTS[:host]') { expect(described_class::DEFAULTS[:host]).to eq 'https://api.finclear.io' }
|
13
13
|
it('sets DEFAULTS[:timeout]') { expect(described_class::DEFAULTS[:timeout]).to eq 30 }
|
14
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::
|
15
|
+
it('sets DEFAULTS[:log_level]') { expect(described_class::DEFAULTS[:log_level]).to eq Logger::UNKNOWN }
|
16
16
|
end
|
17
17
|
end
|
data/spec/rest/resources_spec.rb
CHANGED
@@ -1,30 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'spec_helpers/client'
|
4
|
-
|
5
3
|
RSpec.describe FinAppsCore::REST::Resources do
|
6
|
-
include SpecHelpers::Client
|
7
|
-
subject { FinAppsCore::REST::Resources.new client }
|
8
|
-
|
9
4
|
describe '#new' do
|
10
|
-
context '
|
11
|
-
|
5
|
+
context 'with a valid client param' do
|
6
|
+
subject(:resources) { described_class.new :client }
|
7
|
+
|
8
|
+
it { expect { resources }.not_to raise_error }
|
12
9
|
end
|
13
10
|
|
14
11
|
context 'when missing client param' do
|
15
|
-
subject {
|
16
|
-
it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
17
|
-
end
|
18
|
-
end
|
12
|
+
subject(:resources) { described_class.new nil }
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
describe '#show' do
|
27
|
-
end
|
28
|
-
describe '#destroy' do
|
14
|
+
it {
|
15
|
+
expect { resources }
|
16
|
+
.to raise_error(FinAppsCore::MissingArgumentsError)
|
17
|
+
}
|
18
|
+
end
|
29
19
|
end
|
30
20
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -29,12 +29,12 @@ RSpec.configure do |config|
|
|
29
29
|
config.warnings = true
|
30
30
|
Kernel.srand config.seed
|
31
31
|
|
32
|
-
config.before
|
32
|
+
config.before do
|
33
33
|
base_url = "#{FinAppsCore::REST::Defaults::DEFAULTS[:host]}/v#{FinAppsCore::REST::Defaults::API_VERSION}/"
|
34
34
|
stub_request(:any, /#{base_url}/).to_rack(::FakeApi)
|
35
35
|
end
|
36
36
|
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
37
37
|
end
|
38
38
|
|
39
|
-
VALID_CREDENTIALS = {
|
40
|
-
|
39
|
+
VALID_CREDENTIALS = {identifier: '49fb918d-7e71-44dd-7378-58f19606df2a',
|
40
|
+
token: 'hohoho='}.freeze
|
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
|
@@ -6,19 +6,20 @@ end
|
|
6
6
|
|
7
7
|
RSpec.describe FinAppsCore::Utils::Validatable do
|
8
8
|
describe '#not_blank' do
|
9
|
-
context '
|
10
|
-
it '
|
11
|
-
expect { FakeClass.new.not_blank(nil) }
|
9
|
+
context 'with null values' do
|
10
|
+
it 'raises FinAppsCore::MissingArgumentsError' do
|
11
|
+
expect { FakeClass.new.not_blank(nil) }
|
12
|
+
.to raise_error(FinAppsCore::MissingArgumentsError)
|
12
13
|
end
|
13
14
|
|
14
|
-
it '
|
15
|
-
expect { FakeClass.new.not_blank(nil, :name) }
|
16
|
-
|
15
|
+
it 'describes the argument name when provided' do
|
16
|
+
expect { FakeClass.new.not_blank(nil, :name) }
|
17
|
+
.to raise_error(FinAppsCore::MissingArgumentsError, ': name')
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
context '
|
21
|
-
it '
|
21
|
+
context 'with non null values' do
|
22
|
+
it 'does not raise' do
|
22
23
|
expect { FakeClass.new.not_blank(true) }.not_to raise_error
|
23
24
|
end
|
24
25
|
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.13
|
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-19 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
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: 3.8.0
|
140
137
|
- - "~>"
|
141
138
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
139
|
+
version: '1.8'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::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
|
-
- - ">="
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: 3.8.0
|
150
147
|
- - "~>"
|
151
148
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
149
|
+
version: '1.8'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::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
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 0.75.0
|
160
157
|
- - "~>"
|
161
158
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
159
|
+
version: '1.9'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::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
|
-
- - ">="
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: 0.75.0
|
170
167
|
- - "~>"
|
171
168
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
169
|
+
version: '1.9'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::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
|
-
- - ">="
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: 1.5.0
|
180
177
|
- - "~>"
|
181
178
|
- !ruby/object:Gem::Version
|
182
|
-
version: '
|
179
|
+
version: '0.5'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::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
|
-
- - ">="
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: 1.5.0
|
190
187
|
- - "~>"
|
191
188
|
- !ruby/object:Gem::Version
|
192
|
-
version: '
|
189
|
+
version: '0.5'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::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
|
-
- - ">="
|
198
|
-
- !ruby/object:Gem::Version
|
199
|
-
version: 1.36.0
|
200
197
|
- - "~>"
|
201
198
|
- !ruby/object:Gem::Version
|
202
|
-
version: '1
|
199
|
+
version: '2.1'
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
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
|
-
- - ">="
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: 1.36.0
|
210
207
|
- - "~>"
|
211
208
|
- !ruby/object:Gem::Version
|
212
|
-
version: '1
|
209
|
+
version: '2.1'
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 2.1.0
|
213
213
|
- !ruby/object:Gem::Dependency
|
214
214
|
name: sinatra
|
215
215
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,22 +234,22 @@ dependencies:
|
|
234
234
|
name: webmock
|
235
235
|
requirement: !ruby/object:Gem::Requirement
|
236
236
|
requirements:
|
237
|
-
- - ">="
|
238
|
-
- !ruby/object:Gem::Version
|
239
|
-
version: 3.6.0
|
240
237
|
- - "~>"
|
241
238
|
- !ruby/object:Gem::Version
|
242
239
|
version: '3.6'
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: 3.6.0
|
243
243
|
type: :development
|
244
244
|
prerelease: false
|
245
245
|
version_requirements: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
|
-
- - ">="
|
248
|
-
- !ruby/object:Gem::Version
|
249
|
-
version: 3.6.0
|
250
247
|
- - "~>"
|
251
248
|
- !ruby/object:Gem::Version
|
252
249
|
version: '3.6'
|
250
|
+
- - ">="
|
251
|
+
- !ruby/object:Gem::Version
|
252
|
+
version: 3.6.0
|
253
253
|
description: A simple library for communicating with the FinApps REST API. Core functionality.
|
254
254
|
email:
|
255
255
|
- erich@financialapps.com
|
@@ -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"
|
@@ -267,6 +272,7 @@ files:
|
|
267
272
|
- ".rubocop.yml"
|
268
273
|
- ".ruby-gemset"
|
269
274
|
- ".ruby-version"
|
275
|
+
- ".tmuxinator.yml"
|
270
276
|
- ".travis.yml"
|
271
277
|
- Gemfile
|
272
278
|
- LICENSE
|
@@ -285,6 +291,7 @@ files:
|
|
285
291
|
- lib/finapps_core/middleware/request/tenant_authentication.rb
|
286
292
|
- lib/finapps_core/middleware/request/user_agent.rb
|
287
293
|
- lib/finapps_core/middleware/request/x_consumer_id.rb
|
294
|
+
- lib/finapps_core/middleware/request/x_tenant_id.rb
|
288
295
|
- lib/finapps_core/middleware/response/raise_error.rb
|
289
296
|
- lib/finapps_core/rest/base_client.rb
|
290
297
|
- lib/finapps_core/rest/configuration.rb
|
@@ -303,6 +310,7 @@ files:
|
|
303
310
|
- spec/middleware/request/tenant_authentication_spec.rb
|
304
311
|
- spec/middleware/request/user_agent_spec.rb
|
305
312
|
- spec/middleware/request/x_consumer_id_spec.rb
|
313
|
+
- spec/middleware/request/x_tenant_id_spec.rb
|
306
314
|
- spec/middleware/response/raise_error_spec.rb
|
307
315
|
- spec/rest/base_client_spec.rb
|
308
316
|
- spec/rest/configuration_spec.rb
|
@@ -344,25 +352,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
344
352
|
- !ruby/object:Gem::Version
|
345
353
|
version: '0'
|
346
354
|
requirements: []
|
347
|
-
rubygems_version: 3.
|
355
|
+
rubygems_version: 3.1.4
|
348
356
|
signing_key:
|
349
357
|
specification_version: 4
|
350
358
|
summary: FinApps REST API ruby client - Core.
|
351
359
|
test_files:
|
360
|
+
- spec/rest/resources_spec.rb
|
352
361
|
- spec/rest/defaults_spec.rb
|
353
|
-
- spec/rest/base_client_spec.rb
|
354
362
|
- spec/rest/credentials_spec.rb
|
363
|
+
- spec/rest/base_client_spec.rb
|
355
364
|
- spec/rest/configuration_spec.rb
|
356
|
-
- spec/rest/resources_spec.rb
|
357
365
|
- spec/support/fake_api.rb
|
366
|
+
- spec/spec_helper.rb
|
358
367
|
- spec/utils/validatable_spec.rb
|
359
368
|
- spec/spec_helpers/client.rb
|
360
|
-
- spec/
|
361
|
-
- spec/
|
362
|
-
- spec/middleware/request/no_encoding_basic_authentication_spec.rb
|
369
|
+
- spec/middleware/request/request_id_spec.rb
|
370
|
+
- spec/middleware/request/x_consumer_id_spec.rb
|
363
371
|
- spec/middleware/request/user_agent_spec.rb
|
364
372
|
- spec/middleware/request/tenant_authentication_spec.rb
|
365
|
-
- spec/middleware/request/
|
373
|
+
- spec/middleware/request/x_tenant_id_spec.rb
|
374
|
+
- spec/middleware/request/no_encoding_basic_authentication_spec.rb
|
366
375
|
- spec/middleware/request/accept_json_spec.rb
|
367
|
-
- spec/middleware/request/request_id_spec.rb
|
368
376
|
- spec/middleware/response/raise_error_spec.rb
|
377
|
+
- spec/core_extensions/object/is_integer_spec.rb
|