Sha256: da6766c2dd3f50fb19f275d951056bb46fd2c50464d54ea4d31f75754033b12b

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

require 'httparty'
require 'logger'
require "fdic/version"
require 'fdic/client'
require 'fdic/record'
require 'fdic/bank'
require 'fdic/institution'
require 'fdic/branch'
require 'fdic/history_event'

module FDIC
  module BankFind

    def find_bank(bank_name)
      resp = Client.new.find_bank(bank_name)
      resp['d']['results'].map { |result|
        Bank.new(result)
      }
    end

    def find_institution(certificate_number)
      resp = Client.new.find_institution(certificate_number)
      result = resp['d']['results'].first
      Institution.new(result)
    end

    def find_branches(certificate_number)
      resp = Client.new.find_branches(certificate_number)
      resp['d']['results'].map { |result|
        Branch.new(result)
      }
    end

    def find_history_events(bank_name, certificate_number)
      resp = Client.new.find_history_events(bank_name, certificate_number)
      resp['d']['results'].map { |result|
        HistoryEvent.new(result)
      }
    end

    extend self
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fdic-0.4.0 lib/fdic.rb