class NCUA::Client

Public Instance Methods

find_credit_union_by_address(address, radius = 100) click to toggle source

debug_output $stderr

# File lib/ncua/client.rb, line 9
def find_credit_union_by_address(address, radius = 100)
  parse_response(self.class.post(query_endpoint, query: {
    address: address,
    type: 'address',
    radius: radius.to_s }))
end
find_credit_union_by_charter_number(charter_number) click to toggle source
# File lib/ncua/client.rb, line 22
def find_credit_union_by_charter_number(charter_number)
  parse_response(self.class.post(query_endpoint, query: {
    radius: 100,
    address: charter_number,
    type: 'cunumber' }))
end
find_credit_union_by_name(name) click to toggle source
# File lib/ncua/client.rb, line 16
def find_credit_union_by_name(name)
  parse_response(self.class.post(query_endpoint, query: {
    address: name,
    type: 'cuname' }))
end

Private Instance Methods

parse_response(response) click to toggle source
# File lib/ncua/client.rb, line 35
def parse_response(response)
  JSON.parse(response.body)
rescue JSON::ParserError
  {}
end
query_endpoint() click to toggle source
# File lib/ncua/client.rb, line 31
def query_endpoint
  '/findCUByRadius.aspx'
end