ncua 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5751b1206868aaa4da06e66a41347d4cb563933
4
- data.tar.gz: f5ee464eb983c2be9c6d2d18de92b33b7b68a084
3
+ metadata.gz: d9f3262cc1bf72feb21aa1491ff34a9c9c8037cb
4
+ data.tar.gz: 6ba76e47e9c751b77bf3d4b36edd8efd322eccea
5
5
  SHA512:
6
- metadata.gz: 4fd44d747dc6000c8254c0de3a85233255aa780ceadec7a63940ef3af5dee456ec322ca23f5bbe2effa547ddb28cdbac2cf7dc9ede730734af6e69f1b48763ff
7
- data.tar.gz: 441d6b5150121fc6c5954ad330d78a68e6e951a73387b805003a7fc50eb5a38202db56aa1b143996d0e31ab4a78e75bb4656162a957dcaeb457f47e6b8746ac1
6
+ metadata.gz: 31ae654ff67138698a76b683cc8bc6812513ed855ed40eb23a044fe92ff727e6a25902564299f4993bbe62989ac071c1e74b6656d820029836aa2a7d0982593a
7
+ data.tar.gz: 4e7887dec9c4f79e5334489f9738e04472e562ab011cf35350792c355fdaa1ef6cb652612d8db191a6ded83ebd6f4e70ca2ec2ed19b06bc6f62a79ff731492f9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ncua (0.10.3)
4
+ ncua (0.10.4)
5
5
  httparty (~> 0.16)
6
6
  nokogiri (~> 1.8)
7
7
 
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  require './lib/tasks/ncua_tasks'
4
+ require 'ncua'
4
5
 
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
@@ -2,28 +2,28 @@ module NCUA
2
2
  class Client
3
3
  include HTTParty
4
4
 
5
- base_uri 'http://mapping.ncua.gov'
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
@@ -1,3 +1,3 @@
1
1
  module NCUA
2
- VERSION = "0.10.3"
2
+ VERSION = "0.10.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncua
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Reznick