Sha256: 46e18893c8a75d58f21c769d79c60da6a028fd3c37b3dce5a29335157f4e444a

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/try'

class BankingData::AustrianBank < BankingData::Bank
  include ActiveModel::Model

  attr_accessor :bic

  def self.all
    @@all ||= get_all
  end

  def self.get_all
    banks = []
    SmarterCSV.process(file, opts).each do |line|
      bic = line[:'swift-code'].try(:gsub, /"/, '')
      banks << new(bic: bic)
    end
    banks
  end

  def self.file
    File.dirname(__FILE__) +
      '/../../data/kiverzeichnis_gesamt_de_1381499802577.csv'
  end

  def self.opts
    {
      col_sep: ';',
      file_encoding: 'iso-8859-1',
      force_simple_split: true
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
banking_data-0.3.0 lib/banking_data/austrian_bank.rb
banking_data-0.2.0 lib/banking_data/austrian_bank.rb