class Flutterwave::BankAPI

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/flutterwave/bank.rb, line 5
def initialize(client)
  @client = client
end

Public Instance Methods

find_by_code(code) click to toggle source
# File lib/flutterwave/bank.rb, line 21
def find_by_code(code)
  list.detect do |bank|
    bank.code == code
  end
end
find_by_name(name_match) click to toggle source
# File lib/flutterwave/bank.rb, line 27
def find_by_name(name_match)
  list.detect do |bank|
    !(bank.name.downcase =~ /#{name_match.downcase}/).nil?
  end
end
list() click to toggle source

www.flutterwave.com/documentation/banks-enquiry/

# File lib/flutterwave/bank.rb, line 10
def list
  response = post(
    Flutterwave::Utils::Constants::BANK[:list_url]
  )

  all_banks = response['data']
  all_banks.keys.inject([]) do |list, code|
    list << Bank.new(code, all_banks[code])
  end
end
post(url, data = {}) click to toggle source
# File lib/flutterwave/bank.rb, line 33
def post(url, data = {})
  Flutterwave::Utils::NetworkManager.post(url, data)
end