finapps 3.0.5 → 3.0.6
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/lib/finapps/rest/consumers.rb +5 -0
- data/lib/finapps/rest/sessions.rb +7 -2
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/consumers_spec.rb +26 -0
- data/spec/rest/sessions_spec.rb +11 -1
- data/spec/support/fake_api.rb +10 -0
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e38cb6fd3d79fa7ff674427f2c384fd4bb69d46
|
4
|
+
data.tar.gz: 79957e78dafa38959c66762eb37083b6215eb3b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a607f74e179b5ddadea37fd2dd3ed2243012a5f1417f8abf1fb0977e06d7f016b01d18f4182e98737112c105aa14225b43246c40b900fe5962b8d81f0c89d69a
|
7
|
+
data.tar.gz: be14e5dea2ce8d6e64f9af8883b0b27e1920ddc4d0611a7b5cf14e6690b4fcf016c9b2a4275dc95e1fb6f867ae6d4bc8fb907cb9ebd7fa5b9b887b0cb1cb4c4c
|
@@ -5,6 +5,11 @@ module FinApps
|
|
5
5
|
class Consumers < FinAppsCore::REST::Resources # :nodoc:
|
6
6
|
# @param [String] public_id
|
7
7
|
# @return [FinApps::REST::User, Array<String>]
|
8
|
+
def create(params)
|
9
|
+
not_blank(params, :params)
|
10
|
+
super params
|
11
|
+
end
|
12
|
+
|
8
13
|
def show(public_id)
|
9
14
|
not_blank(public_id, :public_id)
|
10
15
|
super public_id
|
@@ -3,15 +3,20 @@
|
|
3
3
|
module FinApps
|
4
4
|
module REST
|
5
5
|
class Sessions < FinAppsCore::REST::Resources # :nodoc:
|
6
|
-
|
7
|
-
|
6
|
+
LOGOUT = 'logout'
|
7
|
+
|
8
8
|
def create(params, path=nil)
|
9
|
+
return super nil, path if path == LOGOUT
|
9
10
|
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
|
10
11
|
path ||= 'login'
|
11
12
|
|
12
13
|
super params, path
|
13
14
|
end
|
14
15
|
|
16
|
+
def destroy
|
17
|
+
create nil, LOGOUT
|
18
|
+
end
|
19
|
+
|
15
20
|
private
|
16
21
|
|
17
22
|
def validates(params)
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/consumers_spec.rb
CHANGED
@@ -6,6 +6,32 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
6
6
|
subject(:users) { FinApps::REST::Consumers.new(client) }
|
7
7
|
missing_public_id = 'Missing argument: public_id'
|
8
8
|
|
9
|
+
describe '#create' do
|
10
|
+
let(:results) { create[0] }
|
11
|
+
let(:error_messages) { create[1] }
|
12
|
+
|
13
|
+
context 'when missing params' do
|
14
|
+
it { expect { subject.create(nil) }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'for valid params' do
|
18
|
+
let(:create) { subject.create(email: 'email', password: 'password') }
|
19
|
+
|
20
|
+
it { expect { create }.not_to raise_error }
|
21
|
+
it('results is a Hashie::Rash') { expect(results).to be_a(Hashie::Mash::Rash) }
|
22
|
+
it('performs a post and returns the response') { expect(results).to respond_to(:public_id) }
|
23
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'for invalid params' do
|
27
|
+
let(:create) { subject.create(email: 'email') }
|
28
|
+
|
29
|
+
it { expect { create }.not_to raise_error }
|
30
|
+
it('results is nil') { expect(results).to be_nil }
|
31
|
+
it('error messages array is populated') { expect(error_messages.first.downcase).to eq('invalid request body') }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
9
35
|
describe '#show' do
|
10
36
|
context 'when missing public_id' do
|
11
37
|
it { expect { subject.show(nil) }.to raise_error(FinAppsCore::MissingArgumentsError, missing_public_id) }
|
data/spec/rest/sessions_spec.rb
CHANGED
@@ -4,9 +4,9 @@ require 'spec_helpers/client'
|
|
4
4
|
|
5
5
|
RSpec.describe FinApps::REST::Sessions, 'initialized with valid FinApps::Client object' do
|
6
6
|
include SpecHelpers::Client
|
7
|
+
subject { FinApps::REST::Sessions.new(client) }
|
7
8
|
|
8
9
|
describe '#create' do
|
9
|
-
subject { FinApps::REST::Sessions.new(client) }
|
10
10
|
let(:create) { subject.create(credentials) }
|
11
11
|
let(:results) { create[0] }
|
12
12
|
let(:error_messages) { create[1] }
|
@@ -50,4 +50,14 @@ RSpec.describe FinApps::REST::Sessions, 'initialized with valid FinApps::Client
|
|
50
50
|
it('error_messages is empty') { expect(error_messages).to be_empty }
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
describe '#destroy' do
|
55
|
+
let(:destroy) { subject.destroy }
|
56
|
+
let(:results) { destroy[0] }
|
57
|
+
let(:error_messages) { destroy[1] }
|
58
|
+
|
59
|
+
it { expect { destroy }.not_to raise_error }
|
60
|
+
it('results is nil') { expect(results).to be_nil }
|
61
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
62
|
+
end
|
53
63
|
end
|
data/spec/support/fake_api.rb
CHANGED
@@ -77,12 +77,22 @@ class FakeApi < Sinatra::Base
|
|
77
77
|
# consumers
|
78
78
|
get('/v3/consumers/valid_public_id') { json_response 200, 'user.json' }
|
79
79
|
get('/v3/consumers/invalid_public_id') { json_response 404, 'resource_not_found.json' }
|
80
|
+
post('/v3/consumers') do
|
81
|
+
request.body.rewind
|
82
|
+
request_payload = JSON.parse request.body.read
|
83
|
+
if request_payload['password']
|
84
|
+
json_response 201, 'user.json'
|
85
|
+
else
|
86
|
+
json_response 400, 'invalid_request_body.json'
|
87
|
+
end
|
88
|
+
end
|
80
89
|
put('/v3/consumers/valid_public_id') { status 204 }
|
81
90
|
put('/v3/consumers/invalid_public_id') { json_response 400, 'invalid_user_id.json' }
|
82
91
|
put('/v3/consumers/valid_public_id/password') { json_response 200, 'user.json' }
|
83
92
|
put('/v3/consumers/invalid_public_id/password') { json_response 404, 'resource_not_found.json' }
|
84
93
|
delete('/v3/consumers/valid_public_id') { status 204 }
|
85
94
|
delete('/v3/consumers/invalid_public_id') { json_response 404, 'resource_not_found.json' }
|
95
|
+
post('/v3/logout') { status 204 }
|
86
96
|
|
87
97
|
# accounts
|
88
98
|
get('/v3/accounts/valid_id/statement/valid_id') { json_response 200, 'fake_pdf_statement.json' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: finapps_core
|
@@ -321,29 +321,29 @@ signing_key:
|
|
321
321
|
specification_version: 4
|
322
322
|
summary: FinApps REST API ruby client.
|
323
323
|
test_files:
|
324
|
-
- spec/rest/
|
325
|
-
- spec/rest/
|
326
|
-
- spec/rest/
|
327
|
-
- spec/rest/user_institutions_forms_spec.rb
|
328
|
-
- spec/rest/client_spec.rb
|
324
|
+
- spec/rest/operators_password_resets_spec.rb
|
325
|
+
- spec/rest/products_spec.rb
|
326
|
+
- spec/rest/statements_spec.rb
|
329
327
|
- spec/rest/version_spec.rb
|
330
|
-
- spec/rest/
|
331
|
-
- spec/rest/operators_spec.rb
|
332
|
-
- spec/rest/order_statuses_spec.rb
|
333
|
-
- spec/rest/order_reports_spec.rb
|
328
|
+
- spec/rest/user_institutions_forms_spec.rb
|
334
329
|
- spec/rest/consumers_spec.rb
|
335
|
-
- spec/rest/sessions_spec.rb
|
336
|
-
- spec/rest/user_institutions_statuses_spec.rb
|
337
330
|
- spec/rest/orders_spec.rb
|
338
|
-
- spec/rest/
|
331
|
+
- spec/rest/order_tokens_spec.rb
|
339
332
|
- spec/rest/institutions_forms_spec.rb
|
333
|
+
- spec/rest/operators_spec.rb
|
334
|
+
- spec/rest/user_institutions_statuses_spec.rb
|
335
|
+
- spec/rest/client_spec.rb
|
336
|
+
- spec/rest/user_institutions_spec.rb
|
337
|
+
- spec/rest/consumer_institution_refreshes_spec.rb
|
338
|
+
- spec/rest/password_resets_spec.rb
|
339
|
+
- spec/rest/order_reports_spec.rb
|
340
|
+
- spec/rest/institutions_spec.rb
|
341
|
+
- spec/rest/order_statuses_spec.rb
|
340
342
|
- spec/rest/order_refreshes_spec.rb
|
341
343
|
- spec/rest/order_notifications_spec.rb
|
342
|
-
- spec/rest/
|
343
|
-
- spec/rest/
|
344
|
-
- spec/rest/user_institutions_spec.rb
|
345
|
-
- spec/rest/products_spec.rb
|
346
|
-
- spec/utils/query_builder_spec.rb
|
344
|
+
- spec/rest/order_assignments_spec.rb
|
345
|
+
- spec/rest/sessions_spec.rb
|
347
346
|
- spec/support/fake_api.rb
|
348
|
-
- spec/
|
347
|
+
- spec/utils/query_builder_spec.rb
|
349
348
|
- spec/spec_helpers/client.rb
|
349
|
+
- spec/spec_helper.rb
|