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.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +4 -1
  3. data/.github/release-drafter.yml +49 -0
  4. data/.github/workflows/main.yaml +38 -0
  5. data/.github/workflows/release-drafter.yml +15 -0
  6. data/.github/workflows/release.yml +54 -0
  7. data/.github/workflows/verify-pr-labeled.yml +14 -0
  8. data/.rubocop.yml +123 -73
  9. data/.tmuxinator.yml +20 -0
  10. data/.travis.yml +5 -6
  11. data/RELEASES.md +8 -0
  12. data/finapps_core.gemspec +9 -10
  13. data/lib/finapps_core.rb +1 -0
  14. data/lib/finapps_core/middleware/middleware.rb +7 -3
  15. data/lib/finapps_core/middleware/request/accept_json.rb +2 -1
  16. data/lib/finapps_core/middleware/request/user_agent.rb +1 -1
  17. data/lib/finapps_core/middleware/request/x_consumer_id.rb +20 -0
  18. data/lib/finapps_core/middleware/response/raise_error.rb +36 -7
  19. data/lib/finapps_core/rest/base_client.rb +20 -32
  20. data/lib/finapps_core/rest/configuration.rb +17 -4
  21. data/lib/finapps_core/rest/connection.rb +31 -21
  22. data/lib/finapps_core/rest/defaults.rb +1 -1
  23. data/lib/finapps_core/utils/loggeable.rb +1 -1
  24. data/lib/finapps_core/utils/validatable.rb +1 -1
  25. data/lib/finapps_core/version.rb +1 -1
  26. data/spec/core_extensions/object/is_integer_spec.rb +6 -7
  27. data/spec/middleware/request/accept_json_spec.rb +7 -3
  28. data/spec/middleware/request/no_encoding_basic_authentication_spec.rb +15 -6
  29. data/spec/middleware/request/request_id_spec.rb +4 -4
  30. data/spec/middleware/request/tenant_authentication_spec.rb +21 -14
  31. data/spec/middleware/request/user_agent_spec.rb +8 -3
  32. data/spec/middleware/request/x_consumer_id_spec.rb +16 -0
  33. data/spec/middleware/response/raise_error_spec.rb +47 -15
  34. data/spec/rest/base_client_spec.rb +87 -43
  35. data/spec/rest/configuration_spec.rb +25 -18
  36. data/spec/rest/credentials_spec.rb +4 -4
  37. data/spec/rest/defaults_spec.rb +1 -1
  38. data/spec/rest/resources_spec.rb +10 -20
  39. data/spec/spec_helper.rb +3 -3
  40. data/spec/support/fake_api.rb +1 -1
  41. data/spec/utils/validatable_spec.rb +9 -8
  42. metadata +73 -84
@@ -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(FinAppsCore::REST::Credentials.new(nil, :token).valid?).to eql(true) }
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(FinAppsCore::REST::Credentials.new(:identifier, nil).valid?).to eql(false) }
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(FinAppsCore::REST::Credentials.new(nil, nil).valid?).to eql(false) }
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(FinAppsCore::REST::Credentials.new(:identifier, :token).valid?).to eql(true) }
18
+ it { expect(described_class.new(:identifier, :token).valid?).to be(true) }
19
19
  end
20
20
  end
21
21
  end
@@ -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::INFO }
15
+ it('sets DEFAULTS[:log_level]') { expect(described_class::DEFAULTS[:log_level]).to eq Logger::UNKNOWN }
16
16
  end
17
17
  end
@@ -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 'for a valid client param' do
11
- it { expect { subject }.not_to raise_error }
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 { FinAppsCore::REST::Resources.new nil }
16
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
17
- end
18
- end
12
+ subject(:resources) { described_class.new nil }
19
13
 
20
- describe '#list' do
21
- end
22
- describe '#create' do
23
- end
24
- describe '#update' do
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
@@ -29,12 +29,12 @@ RSpec.configure do |config|
29
29
  config.warnings = true
30
30
  Kernel.srand config.seed
31
31
 
32
- config.before(:each) do
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 = { identifier: '49fb918d-7e71-44dd-7378-58f19606df2a',
40
- token: 'hohoho=' }.freeze
39
+ VALID_CREDENTIALS = {identifier: '49fb918d-7e71-44dd-7378-58f19606df2a',
40
+ token: 'hohoho='}.freeze
@@ -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
@@ -6,19 +6,20 @@ end
6
6
 
7
7
  RSpec.describe FinAppsCore::Utils::Validatable do
8
8
  describe '#not_blank' do
9
- context 'for null values' do
10
- it 'should raise FinAppsCore::MissingArgumentsError' do
11
- expect { FakeClass.new.not_blank(nil) }.to raise_error(FinAppsCore::MissingArgumentsError)
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 'should describe the argument name when provided' do
15
- expect { FakeClass.new.not_blank(nil, :name) }.to raise_error(FinAppsCore::MissingArgumentsError,
16
- ': name')
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 'for non null values' do
21
- it 'should not raise' do
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.6
4
+ version: 5.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-04 00:00:00.000000000 Z
11
+ date: 2020-08-06 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.15'
19
+ version: '1.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.15.3
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.15'
29
+ version: '1.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.15.3
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
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.12'
40
37
  - - ">="
41
38
  - !ruby/object:Gem::Version
42
- version: 0.12.2
39
+ version: '1.0'
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '0.12'
50
47
  - - ">="
51
48
  - !ruby/object:Gem::Version
52
- version: 0.12.2
49
+ version: '1.0'
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -90,126 +90,106 @@ dependencies:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: 1.0.9
93
- - !ruby/object:Gem::Dependency
94
- name: gem-release
95
- requirement: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '2.0'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 2.0.3
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '2.0'
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: 2.0.3
113
93
  - !ruby/object:Gem::Dependency
114
94
  name: rake
115
95
  requirement: !ruby/object:Gem::Requirement
116
96
  requirements:
117
97
  - - "~>"
118
98
  - !ruby/object:Gem::Version
119
- version: '12.3'
99
+ version: '13.0'
120
100
  - - ">="
121
101
  - !ruby/object:Gem::Version
122
- version: 12.3.2
102
+ version: 13.0.1
123
103
  type: :development
124
104
  prerelease: false
125
105
  version_requirements: !ruby/object:Gem::Requirement
126
106
  requirements:
127
107
  - - "~>"
128
108
  - !ruby/object:Gem::Version
129
- version: '12.3'
109
+ version: '13.0'
130
110
  - - ">="
131
111
  - !ruby/object:Gem::Version
132
- version: 12.3.2
112
+ version: 13.0.1
133
113
  - !ruby/object:Gem::Dependency
134
114
  name: rspec
135
115
  requirement: !ruby/object:Gem::Requirement
136
116
  requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '3.8'
140
117
  - - ">="
141
118
  - !ruby/object:Gem::Version
142
119
  version: 3.8.0
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '3.8'
143
123
  type: :development
144
124
  prerelease: false
145
125
  version_requirements: !ruby/object:Gem::Requirement
146
126
  requirements:
147
- - - "~>"
148
- - !ruby/object:Gem::Version
149
- version: '3.8'
150
127
  - - ">="
151
128
  - !ruby/object:Gem::Version
152
129
  version: 3.8.0
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '3.8'
153
133
  - !ruby/object:Gem::Dependency
154
134
  name: rubocop
155
135
  requirement: !ruby/object:Gem::Requirement
156
136
  requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.75'
160
137
  - - ">="
161
138
  - !ruby/object:Gem::Version
162
- version: 0.75.0
139
+ version: 0.86.0
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: '0.86'
163
143
  type: :development
164
144
  prerelease: false
165
145
  version_requirements: !ruby/object:Gem::Requirement
166
146
  requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '0.75'
170
147
  - - ">="
171
148
  - !ruby/object:Gem::Version
172
- version: 0.75.0
149
+ version: 0.86.0
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.86'
173
153
  - !ruby/object:Gem::Dependency
174
154
  name: rubocop-performance
175
155
  requirement: !ruby/object:Gem::Requirement
176
156
  requirements:
177
157
  - - "~>"
178
158
  - !ruby/object:Gem::Version
179
- version: '1.5'
159
+ version: '1.6'
180
160
  - - ">="
181
161
  - !ruby/object:Gem::Version
182
- version: 1.5.0
162
+ version: 1.6.1
183
163
  type: :development
184
164
  prerelease: false
185
165
  version_requirements: !ruby/object:Gem::Requirement
186
166
  requirements:
187
167
  - - "~>"
188
168
  - !ruby/object:Gem::Version
189
- version: '1.5'
169
+ version: '1.6'
190
170
  - - ">="
191
171
  - !ruby/object:Gem::Version
192
- version: 1.5.0
172
+ version: 1.6.1
193
173
  - !ruby/object:Gem::Dependency
194
174
  name: rubocop-rspec
195
175
  requirement: !ruby/object:Gem::Requirement
196
176
  requirements:
197
- - - "~>"
198
- - !ruby/object:Gem::Version
199
- version: '1.36'
200
177
  - - ">="
201
178
  - !ruby/object:Gem::Version
202
- version: 1.36.0
179
+ version: 1.40.0
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: '1.40'
203
183
  type: :development
204
184
  prerelease: false
205
185
  version_requirements: !ruby/object:Gem::Requirement
206
186
  requirements:
207
- - - "~>"
208
- - !ruby/object:Gem::Version
209
- version: '1.36'
210
187
  - - ">="
211
188
  - !ruby/object:Gem::Version
212
- version: 1.36.0
189
+ version: 1.40.0
190
+ - - "~>"
191
+ - !ruby/object:Gem::Version
192
+ version: '1.40'
213
193
  - !ruby/object:Gem::Dependency
214
194
  name: sinatra
215
195
  requirement: !ruby/object:Gem::Requirement
@@ -234,22 +214,22 @@ dependencies:
234
214
  name: webmock
235
215
  requirement: !ruby/object:Gem::Requirement
236
216
  requirements:
237
- - - "~>"
238
- - !ruby/object:Gem::Version
239
- version: '3.6'
240
217
  - - ">="
241
218
  - !ruby/object:Gem::Version
242
219
  version: 3.6.0
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '3.6'
243
223
  type: :development
244
224
  prerelease: false
245
225
  version_requirements: !ruby/object:Gem::Requirement
246
226
  requirements:
247
- - - "~>"
248
- - !ruby/object:Gem::Version
249
- version: '3.6'
250
227
  - - ">="
251
228
  - !ruby/object:Gem::Version
252
229
  version: 3.6.0
230
+ - - "~>"
231
+ - !ruby/object:Gem::Version
232
+ version: '3.6'
253
233
  description: A simple library for communicating with the FinApps REST API. Core functionality.
254
234
  email:
255
235
  - erich@financialapps.com
@@ -260,6 +240,11 @@ extra_rdoc_files:
260
240
  - LICENSE
261
241
  files:
262
242
  - ".codeclimate.yml"
243
+ - ".github/release-drafter.yml"
244
+ - ".github/workflows/main.yaml"
245
+ - ".github/workflows/release-drafter.yml"
246
+ - ".github/workflows/release.yml"
247
+ - ".github/workflows/verify-pr-labeled.yml"
263
248
  - ".gitignore"
264
249
  - ".gitlab-ci.yml"
265
250
  - ".hound.yml"
@@ -267,10 +252,12 @@ files:
267
252
  - ".rubocop.yml"
268
253
  - ".ruby-gemset"
269
254
  - ".ruby-version"
255
+ - ".tmuxinator.yml"
270
256
  - ".travis.yml"
271
257
  - Gemfile
272
258
  - LICENSE
273
259
  - README.md
260
+ - RELEASES.md
274
261
  - Rakefile
275
262
  - finapps_core.gemspec
276
263
  - lib/core_extensions/object/is_integer.rb
@@ -283,6 +270,7 @@ files:
283
270
  - lib/finapps_core/middleware/request/request_id.rb
284
271
  - lib/finapps_core/middleware/request/tenant_authentication.rb
285
272
  - lib/finapps_core/middleware/request/user_agent.rb
273
+ - lib/finapps_core/middleware/request/x_consumer_id.rb
286
274
  - lib/finapps_core/middleware/response/raise_error.rb
287
275
  - lib/finapps_core/rest/base_client.rb
288
276
  - lib/finapps_core/rest/configuration.rb
@@ -300,6 +288,7 @@ files:
300
288
  - spec/middleware/request/request_id_spec.rb
301
289
  - spec/middleware/request/tenant_authentication_spec.rb
302
290
  - spec/middleware/request/user_agent_spec.rb
291
+ - spec/middleware/request/x_consumer_id_spec.rb
303
292
  - spec/middleware/response/raise_error_spec.rb
304
293
  - spec/rest/base_client_spec.rb
305
294
  - spec/rest/configuration_spec.rb
@@ -341,25 +330,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
330
  - !ruby/object:Gem::Version
342
331
  version: '0'
343
332
  requirements: []
344
- rubyforge_project:
345
- rubygems_version: 2.6.8
333
+ rubygems_version: 3.0.3
346
334
  signing_key:
347
335
  specification_version: 4
348
336
  summary: FinApps REST API ruby client - Core.
349
337
  test_files:
350
- - spec/middleware/response/raise_error_spec.rb
338
+ - spec/spec_helper.rb
339
+ - spec/support/fake_api.rb
340
+ - spec/utils/validatable_spec.rb
341
+ - spec/core_extensions/object/is_integer_spec.rb
342
+ - spec/rest/base_client_spec.rb
343
+ - spec/rest/defaults_spec.rb
344
+ - spec/rest/resources_spec.rb
345
+ - spec/rest/credentials_spec.rb
346
+ - spec/rest/configuration_spec.rb
347
+ - spec/spec_helpers/client.rb
351
348
  - spec/middleware/request/user_agent_spec.rb
349
+ - spec/middleware/request/tenant_authentication_spec.rb
350
+ - spec/middleware/request/x_consumer_id_spec.rb
352
351
  - spec/middleware/request/no_encoding_basic_authentication_spec.rb
353
352
  - spec/middleware/request/request_id_spec.rb
354
- - spec/middleware/request/tenant_authentication_spec.rb
355
353
  - spec/middleware/request/accept_json_spec.rb
356
- - spec/rest/credentials_spec.rb
357
- - spec/rest/configuration_spec.rb
358
- - spec/rest/defaults_spec.rb
359
- - spec/rest/base_client_spec.rb
360
- - spec/rest/resources_spec.rb
361
- - spec/utils/validatable_spec.rb
362
- - spec/support/fake_api.rb
363
- - spec/spec_helper.rb
364
- - spec/core_extensions/object/is_integer_spec.rb
365
- - spec/spec_helpers/client.rb
354
+ - spec/middleware/response/raise_error_spec.rb