finapps 2.2.18 → 2.2.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c589e3db135efac7608182b06253c4486ffb2d41
4
- data.tar.gz: 9dda7d435559e4331224a543bfb65311edd34294
3
+ metadata.gz: 3d89d6d589716009d0126ae2e39742ccfd67000b
4
+ data.tar.gz: 91a56bf9f76cf109f13e1740d1459baaf3c445e8
5
5
  SHA512:
6
- metadata.gz: 3b76819e08295bd3960a7a16e3b98bd598f10610eeabb891d52d2fdf81ba4a533a55756ee29bf4170abf3eda7d21dfea5de50f0d28d0d7f263ff69319223e822
7
- data.tar.gz: 55d096c4eaf472daa1440cfd8fe8b44500452c1a6a998a5a98d3ffcc5c8c375ca1115360a0e1cd98bc4d253285efb6e69175f8d873ac6f9b189fd40834bd87d3
6
+ metadata.gz: 54303fd65a238d89cb79d365163c61c81789e82b26b8211bab7f22b0b5f63af02a4a259f7d122cf0caa431399da2a46c4bdf9088da6c08a293c26d9d16a1e81f
7
+ data.tar.gz: 235816aaef1ac0ee4b4a0ba28c41b7302cf2ee8a6a90ac514e8b4e447c1417934a79cc354fa902e367059acb27f2095036a24783f8d5df69bc34372337bbc3f6
data/finapps.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = Dir['spec/**/*.rb']
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_runtime_dependency 'finapps_core', '~> 2.0', '>= 2.0.17'
23
+ spec.add_runtime_dependency 'finapps_core', '~> 2.0', '>= 2.0.19'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.14', '>= 1.14.3'
26
26
  spec.add_development_dependency 'gem-release', '~> 0.7', '>= 0.7.4'
data/lib/finapps.rb CHANGED
@@ -27,8 +27,4 @@ require 'finapps/rest/operators_password_resets'
27
27
  require 'finapps/rest/products'
28
28
  require 'finapps/utils/query_builder'
29
29
 
30
- # require 'finapps/rest/configuration'
31
- # require 'finapps/rest/credentials'
32
- # require 'finapps/rest/connection'
33
- # require 'finapps/rest/base_client'
34
30
  require 'finapps/rest/client'
@@ -2,23 +2,29 @@
2
2
  module FinApps
3
3
  module REST
4
4
  class Institutions < FinAppsCore::REST::Resources
5
+ ROUTING_NUMBER_LENGTH = 9
6
+
5
7
  def list(search_term)
6
- not_blank(search_term, :search_term)
7
- # API errors when search_term is blank, maybe it shouldn't
8
+ not_blank(search_term, :search_term) # API errors when search_term is blank, maybe it shouldn't
8
9
 
9
10
  path = "#{end_point}/search/#{ERB::Util.url_encode(search_term)}"
10
11
  super path
11
12
  end
12
13
 
13
- def show(routing_number)
14
- not_blank(routing_number, :routing_number)
14
+ def show(id)
15
+ digits = remove_non_digits id
16
+ not_blank(digits, :id)
15
17
 
16
- path = "#{end_point}/routing/#{remove_non_digits routing_number}"
17
- super routing_number, path
18
+ path = "#{end_point}/#{search_type digits}/#{digits}"
19
+ super digits, path
18
20
  end
19
21
 
20
22
  private
21
23
 
24
+ def search_type(digits)
25
+ digits.length >= ROUTING_NUMBER_LENGTH ? :routing : :site
26
+ end
27
+
22
28
  def remove_non_digits(value)
23
29
  value.to_s.gsub(/\D/, '')
24
30
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module FinApps
3
- VERSION = '2.2.18'
3
+ VERSION = '2.2.19'
4
4
  end
@@ -21,8 +21,8 @@ RSpec.describe FinApps::REST::Institutions do
21
21
  end
22
22
 
23
23
  describe '#show' do
24
- context 'when routing_number is missing' do
25
- it { expect { subject.show(nil) }.to raise_error(FinAppsCore::MissingArgumentsError) }
24
+ context 'when id is missing' do
25
+ it { expect { subject.show('') }.to raise_error(FinAppsCore::MissingArgumentsError) }
26
26
  end
27
27
 
28
28
  context 'when proper routing_number is provided' do
@@ -37,5 +37,19 @@ RSpec.describe FinApps::REST::Institutions do
37
37
  it('includes a site_id on the results') { expect(show[RESULTS]).to respond_to(:site_id) }
38
38
  it('includes a org_display_name on the results') { expect(show[RESULTS]).to respond_to(:org_display_name) }
39
39
  end
40
+
41
+
42
+ context 'when proper site_id is provided' do
43
+ # A site_id has less than 9 digits
44
+ let(:show) { subject.show('5') }
45
+
46
+ it { expect { show }.not_to raise_error }
47
+ it('returns no error messages') { expect(show[ERROR_MESSAGES]).to be_empty }
48
+ it('returns a hash on the results') { expect(show[RESULTS]).to be_a(Hash) }
49
+ it('includes a base_url on the results') { expect(show[RESULTS]).to respond_to(:base_url) }
50
+ it('includes a display_name on the results') { expect(show[RESULTS]).to respond_to(:display_name) }
51
+ it('includes a site_id on the results') { expect(show[RESULTS]).to respond_to(:site_id) }
52
+ it('includes a org_display_name on the results') { expect(show[RESULTS]).to respond_to(:org_display_name) }
53
+ end
40
54
  end
41
55
  end
@@ -52,6 +52,8 @@ class FakeApi < Sinatra::Base
52
52
  post('/v2/institutions/site/valid_site_id/add') { json_response 200, 'institution_add.json' }
53
53
  get('/v2/institutions/search/:search_term') { json_response 200, 'institutions_search_list.json' }
54
54
  get('/v2/institutions/routing/:routing_number') { json_response 200, 'institutions_routing_number.json' }
55
+ get('/v2/institutions/site/:site_id') { json_response 200, 'institutions_routing_number.json' }
56
+
55
57
 
56
58
  # user institutions
57
59
  get('/v2/institutions/consumer/valid_id/status') { json_response 200, 'user_institution_status.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: 2.2.18
4
+ version: 2.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '2.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 2.0.17
22
+ version: 2.0.19
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '2.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 2.0.17
32
+ version: 2.0.19
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement