routing_numbers 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ee715bdae269b04214c5023c57c1b5df8a5c44cc
4
+ data.tar.gz: 7ccfd1f254d6a2c7938a8b6cb76077e889c4fa78
5
+ SHA512:
6
+ metadata.gz: d151999087e381dddc6ac3f0d141411e2eb84f95cb22be5ab32ea935e169e3c7bc66cb523113f4a93c2f7eaed9d786f5b06f33000cff871e2e78f3d09f7dfefe
7
+ data.tar.gz: 7d2d74020a68e6af8bd6c9534aa579db59f77a5d03116e416fdbf4ec1ff34d45349f974c2670aac3a9677c765fde10a2e7f716c9c87fbe7f855a504321f75262
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in routing_numbers.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Matt Polito
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ # RoutingNumbers
2
+
3
+ [![Gem Version](http://img.shields.io/gem/v/routing_numbers.svg?style=flat)](http://badge.fury.io/rb/routing_numbers)
4
+ [![Code Climate](http://img.shields.io/codeclimate/github/mattpolito/routing_numbers.svg?style=flat)](https://codeclimate.com/github/mattpolito/routing_numbers)
5
+
6
+ Simple wrapper around the the routingnumbers.info API.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'routing_numbers'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install routing_numbers
23
+
24
+ ## Usage
25
+
26
+ Getting information for a financial institution from their routing number is as easy as:
27
+
28
+ ```ruby
29
+ RoutingNumbers.find("063107513")
30
+ ```
31
+
32
+ This call returns a response object that will look like this:
33
+
34
+ ```ruby
35
+ <RoutingNumbers::Response:0x007f96b58919f0
36
+ @address="MAC N9301-041",
37
+ @city="MINNEAPOLIS",
38
+ @name="WELLS FARGO BANK",
39
+ @routing_number="063107513",
40
+ @state="MN",
41
+ @telephone="800-745-2426",
42
+ @zip="55479",
43
+ @message="OK">
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
+
50
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/routing_numbers.
55
+
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
60
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "routing_numbers"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ require 'oj'
2
+ require 'routing_numbers/configuration'
3
+ require 'routing_numbers/response'
4
+
5
+ module RoutingNumbers
6
+ def self.configure
7
+ yield(self) if block_given?
8
+ end
9
+
10
+ def self.configuration
11
+ Configuration.instance
12
+ end
13
+
14
+ def self.find(routing_number)
15
+ uri = configuration.uri
16
+ uri.path = 'api/data.json'
17
+ uri.query_values = { rn: routing_number.to_s }
18
+ api_response = configuration.client.get(uri.to_s)
19
+ data = Oj.load(api_response)
20
+
21
+ Response.new.tap do |r|
22
+ r.address = data["address"]
23
+ r.city = data["city"]
24
+ r.name = data["customer_name"]
25
+ r.routing_number = data["rn"]
26
+ r.state = data["state"]
27
+ r.telephone = data["telephone"]
28
+ r.zip = data["zip"]
29
+ r.message = data["message"]
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,31 @@
1
+ require 'singleton'
2
+ require 'addressable/uri'
3
+ require 'rest-client'
4
+
5
+ module RoutingNumbers
6
+ class Configuration
7
+ include Singleton
8
+
9
+ attr_writer :secure
10
+
11
+ def base_url
12
+ "routingnumbers.herokuapp.com"
13
+ end
14
+
15
+ def protocol
16
+ secure ? "https" : "http"
17
+ end
18
+
19
+ def secure
20
+ @secure || false
21
+ end
22
+
23
+ def uri
24
+ Addressable::URI.new(host: base_url, scheme: protocol)
25
+ end
26
+
27
+ def client
28
+ RestClient
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,6 @@
1
+ module RoutingNumbers
2
+ class Response
3
+ attr_accessor :address, :city, :message, :name,
4
+ :routing_number, :state, :telephone, :zip
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module RoutingNumbers
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'routing_numbers/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "routing_numbers"
8
+ spec.version = RoutingNumbers::VERSION
9
+ spec.authors = ["Matt Polito"]
10
+ spec.email = ["matt.polito@gmail.com"]
11
+
12
+ spec.summary = %q{Wrapper around the routingnumbers.info API}
13
+ spec.description = %q{Wrapper around the routingnumbers.info API}
14
+ spec.homepage = "https://github.com/mattpolito/routing_numbers"
15
+ spec.license = "MIT"
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_dependency "rest-client"
26
+ spec.add_dependency "oj"
27
+ spec.add_dependency "addressable"
28
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: routing_numbers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Polito
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rest-client
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: oj
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: addressable
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Wrapper around the routingnumbers.info API
112
+ email:
113
+ - matt.polito@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - bin/console
126
+ - bin/setup
127
+ - lib/routing_numbers.rb
128
+ - lib/routing_numbers/configuration.rb
129
+ - lib/routing_numbers/response.rb
130
+ - lib/routing_numbers/version.rb
131
+ - routing_numbers.gemspec
132
+ homepage: https://github.com/mattpolito/routing_numbers
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.4.5
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: Wrapper around the routingnumbers.info API
156
+ test_files: []