bank_lookup 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require './lib/bank_lookup'
2
+
3
+ BankLookup::Parser.parse
4
+
5
+ run BankLookup::API
@@ -0,0 +1,45 @@
1
+ # See https://www.fededirectory.frb.org/format.cfm
2
+
3
+ require 'multi_json'
4
+ require 'sinatra'
5
+ require 'active_support/core_ext/string/inflections'
6
+
7
+ module BankLookup
8
+ class Config
9
+ class << self
10
+ def file
11
+ @file ||= File.join(File.dirname(__FILE__), '..', 'data', 'db.txt')
12
+ end
13
+
14
+ def file=(file)
15
+ @file = file
16
+ end
17
+ end
18
+ end
19
+
20
+ DB = {}
21
+ class Parser
22
+ def self.parse
23
+ # raise "You must specify a database file" if Config.file.nil?
24
+
25
+ File.foreach Config.file do |line|
26
+ number = line[0..8]
27
+ custname = line[27..62].strip
28
+
29
+ DB[number] = custname
30
+ end
31
+ end
32
+ end
33
+
34
+ class API < Sinatra::Base
35
+ # GET /bank_name?number=23413421
36
+ get '/bank_name' do
37
+ number = params['number']
38
+ if name = DB[number]
39
+ MultiJson.encode({:name => name, :pretty_name => name.titleize})
40
+ else
41
+ status 404
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module BankLookup
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bank_lookup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alex Sharp
9
+ - Brent Dillingham
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-10-06 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: multi_json
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: sinatra
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: activesupport
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ description: Lookup bank names by routing number.
64
+ email:
65
+ - ajsharp@gmail.com
66
+ - brentdillingham@gmail.com
67
+ executables:
68
+ - updatedb
69
+ extensions: []
70
+ extra_rdoc_files: []
71
+ files:
72
+ - Gemfile
73
+ - README.md
74
+ - bank_lookup.gemspec
75
+ - bin/updatedb
76
+ - data/db.txt
77
+ - examples/config.ru
78
+ - lib/bank_lookup.rb
79
+ - lib/bank_lookup/version.rb
80
+ homepage: https://github.com/zaarly/bank_lookup
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project: bank_lookup
100
+ rubygems_version: 1.8.24
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Lookup bank names by routing number.
104
+ test_files: []
105
+ has_rdoc: