Sha256: e45412581c11d465f564753d65c70c95108fd44ae663152b80c286758e19a498

Contents?: true

Size: 511 Bytes

Versions: 1

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

require 'yaml'

module Bs2Api
  module Util
    class BankService
      class << self
        def find_by_code code
          code = code.to_s.strip
          bank = bank_list.find {|b| b["code"] == code }
          raise Bs2Api::Errors::MissingBank, "Bank with code '#{code}' not registered into configuration file" if bank.blank?
          bank
        end

        def bank_list
          YAML.load_file(File.join(__dir__, 'banks.yml'))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bs2_api-1.1.5 lib/bs2_api/util/bank_service.rb