ncua 0.10.3 → 0.10.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -0
- data/lib/ncua/client.rb +13 -7
- data/lib/ncua/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f3262cc1bf72feb21aa1491ff34a9c9c8037cb
|
4
|
+
data.tar.gz: 6ba76e47e9c751b77bf3d4b36edd8efd322eccea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ae654ff67138698a76b683cc8bc6812513ed855ed40eb23a044fe92ff727e6a25902564299f4993bbe62989ac071c1e74b6656d820029836aa2a7d0982593a
|
7
|
+
data.tar.gz: 4e7887dec9c4f79e5334489f9738e04472e562ab011cf35350792c355fdaa1ef6cb652612d8db191a6ded83ebd6f4e70ca2ec2ed19b06bc6f62a79ff731492f9
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/lib/ncua/client.rb
CHANGED
@@ -2,28 +2,28 @@ module NCUA
|
|
2
2
|
class Client
|
3
3
|
include HTTParty
|
4
4
|
|
5
|
-
base_uri '
|
5
|
+
base_uri 'https://mapping.ncua.gov'
|
6
6
|
format :json
|
7
7
|
#debug_output $stderr
|
8
8
|
|
9
9
|
def find_credit_union_by_address(address, radius = 100)
|
10
|
-
self.class.post(query_endpoint, query: {
|
10
|
+
parse_response(self.class.post(query_endpoint, query: {
|
11
11
|
address: address,
|
12
12
|
type: 'address',
|
13
|
-
radius: radius.to_s })
|
13
|
+
radius: radius.to_s }))
|
14
14
|
end
|
15
15
|
|
16
16
|
def find_credit_union_by_name(name)
|
17
|
-
self.class.post(query_endpoint, query: {
|
17
|
+
parse_response(self.class.post(query_endpoint, query: {
|
18
18
|
address: name,
|
19
|
-
type: 'cuname' })
|
19
|
+
type: 'cuname' }))
|
20
20
|
end
|
21
21
|
|
22
22
|
def find_credit_union_by_charter_number(charter_number)
|
23
|
-
self.class.post(query_endpoint, query: {
|
23
|
+
parse_response(self.class.post(query_endpoint, query: {
|
24
24
|
radius: 100,
|
25
25
|
address: charter_number,
|
26
|
-
type: 'cunumber' })
|
26
|
+
type: 'cunumber' }))
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
@@ -31,5 +31,11 @@ module NCUA
|
|
31
31
|
def query_endpoint
|
32
32
|
'/findCUByRadius.aspx'
|
33
33
|
end
|
34
|
+
|
35
|
+
def parse_response(response)
|
36
|
+
JSON.parse(response.body)
|
37
|
+
rescue JSON::ParserError
|
38
|
+
{}
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
data/lib/ncua/version.rb
CHANGED