Sha256: 260e48d70f4ccb45386231af69cc719ec190c23a13910d0c71ecbe4a27ed03f0
Contents?: true
Size: 1.94 KB
Versions: 3
Compression:
Stored size: 1.94 KB
Contents
require 'fdic/bank_find/exceptions' require 'fdic/bank_find/client' require 'fdic/bank_find/record' require 'fdic/bank_find/bank' require 'fdic/bank_find/institution' require 'fdic/bank_find/branch' require 'fdic/bank_find/history_event' require 'fdic/bank_find/schema_validators' 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) results = resp.fetch('d').fetch('results') if results.empty? || results.nil? raise FDIC::Exceptions::RecordNotFound, "#{certificate_number} appears to be an invalid certificate number" else Institution.new(results.first) end 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 def validate_schema! FDIC::BankFind::SchemaValidators::InstitutionValidator.new.schema_valid! FDIC::BankFind::SchemaValidators::BankValidator.new.schema_valid! FDIC::BankFind::SchemaValidators::HistoryEventValidator.new.schema_valid! FDIC::BankFind::SchemaValidators::BranchValidator.new.schema_valid! true end def validate_schema? FDIC::BankFind::SchemaValidators::InstitutionValidator.new.schema_valid? && FDIC::BankFind::SchemaValidators::BankValidator.new.schema_valid? && FDIC::BankFind::SchemaValidators::HistoryEventValidator.new.schema_valid? && FDIC::BankFind::SchemaValidators::BranchValidator.new.schema_valid? end extend self end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fdic-0.9.2 | lib/fdic/bank_find.rb |
fdic-0.9.1 | lib/fdic/bank_find.rb |
fdic-0.9.0 | lib/fdic/bank_find.rb |