finapps 2.0.19 → 2.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/finapps/rest/client.rb +8 -0
- data/lib/finapps/rest/institutions.rb +27 -0
- data/lib/finapps/rest/institutions_forms.rb +17 -0
- data/lib/finapps/version.rb +1 -1
- data/lib/finapps.rb +2 -0
- data/spec/rest/institutions_forms_spec.rb +26 -0
- data/spec/rest/institutions_spec.rb +45 -0
- data/spec/support/fake_api.rb +8 -0
- data/spec/support/fixtures/institution_add.json +11 -0
- data/spec/support/fixtures/institution_login_form.json +3 -0
- data/spec/support/fixtures/institutions_search_list.json +74 -0
- data/spec/support/fixtures/invalid_institution_id.json +5 -0
- metadata +25 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9527628458941678b7c20016419c7ca28428977
|
4
|
+
data.tar.gz: dde2b60589faa029658abcd22669950f7371cdf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40e65b20cb6f4273c5f719e89a4ba59a13923de56039a152e83a8747430ec60975785909b19503f63538ba07dab593bbb4322ea2841e075b1382de8970895d46
|
7
|
+
data.tar.gz: f8e53d38f9dcb25abd1531e4b3157c4ad87071c7ebbf1b16817f28507047a6462033d74d69cee14c2875578c4d24f9ff9aced2bacf4177d30e41f501de308ce2
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -35,6 +35,14 @@ module FinApps
|
|
35
35
|
def orders
|
36
36
|
@orders ||= FinApps::REST::Orders.new self
|
37
37
|
end
|
38
|
+
|
39
|
+
def institutions
|
40
|
+
@institutions ||= FinApps::REST::Institutions.new self
|
41
|
+
end
|
42
|
+
|
43
|
+
def institutions_forms
|
44
|
+
@institutions_forms ||= FinApps::REST::InstitutionsForms.new self
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class Institutions < FinApps::REST::Resources
|
5
|
+
require 'erb'
|
6
|
+
using ObjectExtensions
|
7
|
+
using StringExtensions
|
8
|
+
|
9
|
+
def create(site_id, params)
|
10
|
+
raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
|
11
|
+
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
12
|
+
|
13
|
+
path = "#{end_point}/site/#{ERB::Util.url_encode(site_id)}/add"
|
14
|
+
|
15
|
+
super params, path
|
16
|
+
end
|
17
|
+
|
18
|
+
def list(search_term)
|
19
|
+
raise MissingArgumentsError.new 'Missing argument: search_term' if search_term.blank?
|
20
|
+
# API errors when search_term is blank, maybe it shouldn't
|
21
|
+
|
22
|
+
path = "#{end_point}/search/#{ERB::Util.url_encode(search_term)}"
|
23
|
+
super path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class InstitutionsForms < FinApps::REST::Resources
|
5
|
+
require 'erb'
|
6
|
+
using ObjectExtensions
|
7
|
+
using StringExtensions
|
8
|
+
|
9
|
+
def show(site_id)
|
10
|
+
raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
|
11
|
+
|
12
|
+
path = "institutions/site/#{ERB::Util.url_encode(site_id)}/form"
|
13
|
+
super site_id, path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/finapps/version.rb
CHANGED
data/lib/finapps.rb
CHANGED
@@ -25,6 +25,8 @@ require 'finapps/rest/users'
|
|
25
25
|
require 'finapps/rest/sessions'
|
26
26
|
require 'finapps/rest/order_tokens'
|
27
27
|
require 'finapps/rest/orders'
|
28
|
+
require 'finapps/rest/institutions_forms'
|
29
|
+
require 'finapps/rest/institutions'
|
28
30
|
|
29
31
|
require 'finapps/rest/configuration'
|
30
32
|
require 'finapps/rest/credentials'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
RSpec.describe FinApps::REST::InstitutionsForms do
|
3
|
+
let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
4
|
+
describe '#show' do
|
5
|
+
context 'when missing site id' do
|
6
|
+
subject { FinApps::REST::InstitutionsForms.new(client).show(nil) }
|
7
|
+
it('raises missing argument error') { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'when valid site id provided' do
|
11
|
+
subject { FinApps::REST::InstitutionsForms.new(client).show('valid_site_id') }
|
12
|
+
|
13
|
+
it { expect { subject }.not_to raise_error }
|
14
|
+
it('performs a get and returns the login html') { expect(subject[0]).to respond_to(:login_form_html) }
|
15
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when invalid site id provided' do
|
19
|
+
subject { FinApps::REST::InstitutionsForms.new(client).show('invalid_site_id') }
|
20
|
+
|
21
|
+
it { expect { subject }.not_to raise_error }
|
22
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
23
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid institution id') }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
RSpec.describe FinApps::REST::Institutions do
|
3
|
+
let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
4
|
+
describe '#create' do
|
5
|
+
subject(:institutions) { FinApps::REST::Institutions.new(client) }
|
6
|
+
|
7
|
+
context 'when missing site_id' do
|
8
|
+
let(:create) { subject.create(nil, :params) }
|
9
|
+
it { expect { create }.to raise_error(FinApps::MissingArgumentsError) }
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'when missing params' do
|
13
|
+
let(:create) { subject.create(:site_id, nil) }
|
14
|
+
it { expect { create }.to raise_error(FinApps::MissingArgumentsError) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when valid site_id and params are provided' do
|
18
|
+
let(:create) { subject.create('valid_site_id', :params) }
|
19
|
+
|
20
|
+
it { expect { create }.not_to raise_error }
|
21
|
+
it('performs a post and returns the response') { expect(create[0]).to respond_to(:user_institution) }
|
22
|
+
it('returns no error messages') { expect(create[1]).to be_empty }
|
23
|
+
end
|
24
|
+
|
25
|
+
# No tests for invalid site_id/params because of API/Yodlee flow
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#list' do
|
29
|
+
subject(:institutions) { FinApps::REST::Institutions.new(client) }
|
30
|
+
|
31
|
+
context 'when search_term is missing' do
|
32
|
+
let(:list) { subject.list(nil) }
|
33
|
+
it { expect { list }.to raise_error(FinApps::MissingArgumentsError) }
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when proper search_term is provided' do
|
37
|
+
let(:list) { subject.list(:search_term) }
|
38
|
+
|
39
|
+
it { expect { list }.not_to raise_error }
|
40
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
41
|
+
it('performs a get and returns institution array') { expect(list[0]).to be_a(Array) }
|
42
|
+
it('returns no error messages') { expect(list[1]).to be_empty }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/support/fake_api.rb
CHANGED
@@ -16,6 +16,14 @@ class FakeApi < Sinatra::Base
|
|
16
16
|
get('/v2/orders/:id') { json_response 200, 'resource.json' }
|
17
17
|
get('/v2/list/orders/:page/:requested/:sort/:asc') { json_response 200, 'orders.json' }
|
18
18
|
|
19
|
+
# institutions
|
20
|
+
get('/v2/institutions/site/valid_site_id/form') { json_response 200, 'institution_login_form.json' }
|
21
|
+
get('/v2/institutions/site/invalid_site_id/form') { json_response 400, 'invalid_institution_id.json' }
|
22
|
+
post('/v2/institutions/site/valid_site_id/add') { json_response 200, 'institution_add.json' }
|
23
|
+
post('/v2/institutions/site/invalid_site_id/add') { json_response 400, 'invalid_institution_id.json' }
|
24
|
+
get('/v2/institutions/search/:search_term') { json_response 200, 'institutions_search_list.json' }
|
25
|
+
|
26
|
+
|
19
27
|
# users
|
20
28
|
get('/v2/users/valid_public_id') { json_response 200, 'user.json' }
|
21
29
|
get('/v2/users/invalid_public_id') { json_response 404, 'resource_not_found.json' }
|
@@ -0,0 +1,3 @@
|
|
1
|
+
{
|
2
|
+
"login_form_html": "<div class='loginField'><label class='loginFieldName'>Catalog</label><input class='loginFieldInput' type='TEXT' name='LOGIN' value='' maxlength='40' size='20'></div><div class='loginField'><label class='loginFieldName'>Password</label><input class='loginFieldInput' type='PASSWORD' name='PASSWORD' value='' maxlength='40' size='20'></div>"
|
3
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"base_url": "https://www.citibank.co.th",
|
4
|
+
"display_name": "CITIBANK (Thailand)",
|
5
|
+
"site_id": 20638,
|
6
|
+
"org_display_name": "Citigroup Inc"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"base_url": "http://www.citibank.com.au/",
|
10
|
+
"display_name": "Citibank (Australia)",
|
11
|
+
"site_id": 10388,
|
12
|
+
"org_display_name": "Citigroup"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"base_url": "https://www.citibank.com.br/BRGCB/JPS/portal/Index.do",
|
16
|
+
"display_name": "Citibank (Brazil)",
|
17
|
+
"site_id": 17781,
|
18
|
+
"org_display_name": "Citibank (Brazil)"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"base_url": "https://online.citibank.com/US/Welcome.c",
|
22
|
+
"display_name": "Citibank (Colombia)",
|
23
|
+
"site_id": 17780,
|
24
|
+
"org_display_name": "Citibank (Colombia)"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"base_url": "https://www.citibank.co.in",
|
28
|
+
"display_name": "Citibank (India)",
|
29
|
+
"site_id": 9864,
|
30
|
+
"org_display_name": "Citigroup"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"base_url": "http://www.citibank.com.sg/",
|
34
|
+
"display_name": "Citibank (Singapore)",
|
35
|
+
"site_id": 18079,
|
36
|
+
"org_display_name": "Citibank (Singapore)"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"base_url": "http://www.citibank.com/uk/",
|
40
|
+
"display_name": "Citibank (UK)",
|
41
|
+
"site_id": 4057,
|
42
|
+
"org_display_name": "Citigroup"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"base_url": "https://online.citibank.com/US/Welcome.c",
|
46
|
+
"display_name": "Citibank (online.citibank.com) (US)",
|
47
|
+
"site_id": 1603,
|
48
|
+
"org_display_name": "Citigroup"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"base_url": "http://citibankonline.com",
|
52
|
+
"display_name": "Citibank AT1 (US)",
|
53
|
+
"site_id": 5732,
|
54
|
+
"org_display_name": "Citigroup"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"base_url": "http://hsa.citibank.com/",
|
58
|
+
"display_name": "Citibank Health Savings Account (US)",
|
59
|
+
"site_id": 13256,
|
60
|
+
"org_display_name": "Citigroup"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"base_url": "http://www.citibank.com.au/",
|
64
|
+
"display_name": "Citibank Personal Loan (Australia)",
|
65
|
+
"site_id": 12718,
|
66
|
+
"org_display_name": "Citigroup"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"base_url": "http://www.citibank.com/uk/portal/consumer/investments/sharedealing/index_td.htm",
|
70
|
+
"display_name": "Citibank Sharedealing Service (UK)",
|
71
|
+
"site_id": 8646,
|
72
|
+
"org_display_name": "Citigroup"
|
73
|
+
}
|
74
|
+
]
|
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: 2.0.
|
4
|
+
version: 2.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -261,6 +261,8 @@ files:
|
|
261
261
|
- lib/finapps/rest/connection.rb
|
262
262
|
- lib/finapps/rest/credentials.rb
|
263
263
|
- lib/finapps/rest/defaults.rb
|
264
|
+
- lib/finapps/rest/institutions.rb
|
265
|
+
- lib/finapps/rest/institutions_forms.rb
|
264
266
|
- lib/finapps/rest/order_tokens.rb
|
265
267
|
- lib/finapps/rest/orders.rb
|
266
268
|
- lib/finapps/rest/resources.rb
|
@@ -279,6 +281,8 @@ files:
|
|
279
281
|
- spec/rest/client_spec.rb
|
280
282
|
- spec/rest/configuration_spec.rb
|
281
283
|
- spec/rest/credentials_spec.rb
|
284
|
+
- spec/rest/institutions_forms_spec.rb
|
285
|
+
- spec/rest/institutions_spec.rb
|
282
286
|
- spec/rest/order_tokens_spec.rb
|
283
287
|
- spec/rest/orders_spec.rb
|
284
288
|
- spec/rest/resources_spec.rb
|
@@ -288,6 +292,10 @@ files:
|
|
288
292
|
- spec/spec_helpers/client.rb
|
289
293
|
- spec/support/fake_api.rb
|
290
294
|
- spec/support/fixtures/error.json
|
295
|
+
- spec/support/fixtures/institution_add.json
|
296
|
+
- spec/support/fixtures/institution_login_form.json
|
297
|
+
- spec/support/fixtures/institutions_search_list.json
|
298
|
+
- spec/support/fixtures/invalid_institution_id.json
|
291
299
|
- spec/support/fixtures/order_token.json
|
292
300
|
- spec/support/fixtures/orders.json
|
293
301
|
- spec/support/fixtures/relevance_ruleset_names.json
|
@@ -322,26 +330,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
330
|
version: '0'
|
323
331
|
requirements: []
|
324
332
|
rubyforge_project:
|
325
|
-
rubygems_version: 2.
|
333
|
+
rubygems_version: 2.6.6
|
326
334
|
signing_key:
|
327
335
|
specification_version: 4
|
328
336
|
summary: FinApps REST API ruby client.
|
329
337
|
test_files:
|
330
|
-
- spec/
|
331
|
-
- spec/
|
338
|
+
- spec/spec_helpers/client.rb
|
339
|
+
- spec/core_extensions/object/is_integer_spec.rb
|
340
|
+
- spec/core_extensions/hash/compact_spec.rb
|
332
341
|
- spec/middleware/request/tenant_authentication_spec.rb
|
333
342
|
- spec/middleware/request/accept_json_spec.rb
|
343
|
+
- spec/middleware/request/user_agent_spec.rb
|
334
344
|
- spec/middleware/response/raise_error_spec.rb
|
335
|
-
- spec/
|
336
|
-
- spec/core_extensions/object/is_integer_spec.rb
|
337
|
-
- spec/spec_helpers/client.rb
|
345
|
+
- spec/support/fake_api.rb
|
338
346
|
- spec/spec_helper.rb
|
339
|
-
- spec/rest/credentials_spec.rb
|
340
|
-
- spec/rest/order_tokens_spec.rb
|
341
|
-
- spec/rest/users_spec.rb
|
342
|
-
- spec/rest/base_client_spec.rb
|
343
|
-
- spec/rest/client_spec.rb
|
344
|
-
- spec/rest/orders_spec.rb
|
345
347
|
- spec/rest/configuration_spec.rb
|
346
|
-
- spec/rest/
|
348
|
+
- spec/rest/institutions_forms_spec.rb
|
349
|
+
- spec/rest/users_spec.rb
|
347
350
|
- spec/rest/sessions_spec.rb
|
351
|
+
- spec/rest/resources_spec.rb
|
352
|
+
- spec/rest/credentials_spec.rb
|
353
|
+
- spec/rest/orders_spec.rb
|
354
|
+
- spec/rest/client_spec.rb
|
355
|
+
- spec/rest/base_client_spec.rb
|
356
|
+
- spec/rest/order_tokens_spec.rb
|
357
|
+
- spec/rest/institutions_spec.rb
|