fdic 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -7
- data/lib/fdic/{bank.rb → bank_find/bank.rb} +0 -0
- data/lib/fdic/{branch.rb → bank_find/branch.rb} +0 -0
- data/lib/fdic/{client.rb → bank_find/client.rb} +0 -0
- data/lib/fdic/bank_find/exceptions.rb +5 -0
- data/lib/fdic/{history_event.rb → bank_find/history_event.rb} +0 -0
- data/lib/fdic/{institution.rb → bank_find/institution.rb} +0 -0
- data/lib/fdic/{record.rb → bank_find/record.rb} +0 -0
- data/lib/fdic/bank_find.rb +45 -0
- data/lib/fdic/version.rb +1 -1
- data/lib/fdic.rb +1 -40
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a272bf5ef7ba4ae55c152d39e39a8e989d0a2676
|
4
|
+
data.tar.gz: ace1b5464a695805a4c120470b6051a786f8a661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b6771c3db012e2cc16af79066acf7a16daede58cc375c98b21aff578c6cba9120b7bcbf1b72f5e9ff2bdb194a27bb47ae622a5b4ecc7402f74d8220b8ba69c
|
7
|
+
data.tar.gz: 9d65c447c1c37923321e6c44670d7de7c427b0957b08667eca2cc7d6858df0b92428b0c668134eb5405e8cf52f055961bd04a27ca88d4f204f770944f7c1da8f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -38,29 +38,36 @@ Or install it yourself as:
|
|
38
38
|
|
39
39
|
## Usage
|
40
40
|
|
41
|
-
The FDIC API lets you find an Institution if you have its FDIC Certificate Number:
|
42
|
-
|
43
41
|
Currently all of our features are namespaced under the `FDIC::BankFind` module
|
44
42
|
|
43
|
+
The FDIC API lets you find an Institution if you have its FDIC Certificate Number:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
institution = FDIC::BankFind.find_institution(26588) #=> FDIC::BankFind::Institution
|
45
47
|
```
|
48
|
+
|
49
|
+
If your certificate number is incorrect, this will raise an exception:
|
50
|
+
|
51
|
+
```ruby
|
46
52
|
institution = FDIC::BankFind.find_institution(26588) #=> FDIC::BankFind::Institution
|
53
|
+
# raises FDIC::Exceptions::RecordNotFound
|
47
54
|
```
|
48
55
|
|
49
56
|
If you don't have the certificate number, you can search for a Bank by name, and get back all matching Banks:
|
50
57
|
|
51
|
-
```
|
58
|
+
```ruby
|
52
59
|
banks = FDIC::BankFind.find_bank('Dedicated Community Bank') #=> [FDIC::BankFind::Bank, FDIC::BankFind::Bank, ...]
|
53
60
|
```
|
54
61
|
|
55
62
|
Once you have a Bank, you can get its Institution, which has much more data available:
|
56
63
|
|
57
|
-
```
|
64
|
+
```ruby
|
58
65
|
institution = banks.first.find_institution! # Bang, because it's another network request
|
59
66
|
```
|
60
67
|
|
61
68
|
The API also exposes information about an Institution's branches, and its history. You can query both of these on the FDIC::BankFind module directly, or on the Institution:
|
62
69
|
|
63
|
-
```
|
70
|
+
```ruby
|
64
71
|
institution.find_branches! #=> [FDIC::BankFind::Branch, FDIC::BankFind::Branch, ...]
|
65
72
|
FDIC::BankFind.find_branches(25688) #=> [FDIC::BankFind::Branch, FDIC::BankFind::Branch, ...]
|
66
73
|
|
@@ -70,7 +77,7 @@ FDIC::BankFind.find_history_events('Dedicated Community Bank', 26588) #=> [FDI
|
|
70
77
|
|
71
78
|
Since a `Bank` knows its certificate number, it can look up its branch and history information, too.
|
72
79
|
|
73
|
-
```
|
80
|
+
```ruby
|
74
81
|
# These work just like they do on Institutions:
|
75
82
|
bank.find_branches!
|
76
83
|
bank.find_history_events!
|
@@ -85,4 +92,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Contin
|
|
85
92
|
## License
|
86
93
|
|
87
94
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
88
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'fdic/bank_find/exceptions'
|
2
|
+
require 'fdic/bank_find/client'
|
3
|
+
require 'fdic/bank_find/record'
|
4
|
+
require 'fdic/bank_find/bank'
|
5
|
+
require 'fdic/bank_find/institution'
|
6
|
+
require 'fdic/bank_find/branch'
|
7
|
+
require 'fdic/bank_find/history_event'
|
8
|
+
|
9
|
+
module FDIC
|
10
|
+
module BankFind
|
11
|
+
|
12
|
+
def find_bank(bank_name)
|
13
|
+
resp = Client.new.find_bank(bank_name)
|
14
|
+
resp['d']['results'].map { |result|
|
15
|
+
Bank.new(result)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def find_institution(certificate_number)
|
20
|
+
resp = Client.new.find_institution(certificate_number)
|
21
|
+
results = resp.fetch('d').fetch('results')
|
22
|
+
if results.empty? || results.nil?
|
23
|
+
raise FDIC::Exceptions::RecordNotFound, "#{certificate_number} appears to be an invalid certificate number"
|
24
|
+
else
|
25
|
+
Institution.new(results.first)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_branches(certificate_number)
|
30
|
+
resp = Client.new.find_branches(certificate_number)
|
31
|
+
resp['d']['results'].map { |result|
|
32
|
+
Branch.new(result)
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def find_history_events(bank_name, certificate_number)
|
37
|
+
resp = Client.new.find_history_events(bank_name, certificate_number)
|
38
|
+
resp['d']['results'].map { |result|
|
39
|
+
HistoryEvent.new(result)
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
extend self
|
44
|
+
end
|
45
|
+
end
|
data/lib/fdic/version.rb
CHANGED
data/lib/fdic.rb
CHANGED
@@ -1,43 +1,4 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'logger'
|
3
3
|
require "fdic/version"
|
4
|
-
require 'fdic/
|
5
|
-
require 'fdic/record'
|
6
|
-
require 'fdic/bank'
|
7
|
-
require 'fdic/institution'
|
8
|
-
require 'fdic/branch'
|
9
|
-
require 'fdic/history_event'
|
10
|
-
|
11
|
-
module FDIC
|
12
|
-
module BankFind
|
13
|
-
|
14
|
-
def find_bank(bank_name)
|
15
|
-
resp = Client.new.find_bank(bank_name)
|
16
|
-
resp['d']['results'].map { |result|
|
17
|
-
Bank.new(result)
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def find_institution(certificate_number)
|
22
|
-
resp = Client.new.find_institution(certificate_number)
|
23
|
-
result = resp['d']['results'].first
|
24
|
-
Institution.new(result)
|
25
|
-
end
|
26
|
-
|
27
|
-
def find_branches(certificate_number)
|
28
|
-
resp = Client.new.find_branches(certificate_number)
|
29
|
-
resp['d']['results'].map { |result|
|
30
|
-
Branch.new(result)
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
def find_history_events(bank_name, certificate_number)
|
35
|
-
resp = Client.new.find_history_events(bank_name, certificate_number)
|
36
|
-
resp['d']['results'].map { |result|
|
37
|
-
HistoryEvent.new(result)
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
extend self
|
42
|
-
end
|
43
|
-
end
|
4
|
+
require 'fdic/bank_find'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fdic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Reznick
|
@@ -87,12 +87,14 @@ files:
|
|
87
87
|
- bin/setup
|
88
88
|
- fdic.gemspec
|
89
89
|
- lib/fdic.rb
|
90
|
-
- lib/fdic/
|
91
|
-
- lib/fdic/
|
92
|
-
- lib/fdic/
|
93
|
-
- lib/fdic/
|
94
|
-
- lib/fdic/
|
95
|
-
- lib/fdic/
|
90
|
+
- lib/fdic/bank_find.rb
|
91
|
+
- lib/fdic/bank_find/bank.rb
|
92
|
+
- lib/fdic/bank_find/branch.rb
|
93
|
+
- lib/fdic/bank_find/client.rb
|
94
|
+
- lib/fdic/bank_find/exceptions.rb
|
95
|
+
- lib/fdic/bank_find/history_event.rb
|
96
|
+
- lib/fdic/bank_find/institution.rb
|
97
|
+
- lib/fdic/bank_find/record.rb
|
96
98
|
- lib/fdic/version.rb
|
97
99
|
homepage: https://github.com/ContinuityControl/fdic
|
98
100
|
licenses:
|