class SepaClearer::DeutscheBundesbank
Constants
- MAPPING
Public Instance Methods
data(file = nil)
click to toggle source
# File lib/sepa_clearer/deutsche_bundesbank.rb, line 12 def data(file = nil) @data ||= begin [].tap do |data| CSV.foreach(file || default_data_file, { headers: true, col_sep: ';', header_converters: :symbol, encoding: "iso-8859-1:UTF-8" }) do |row| data.push PaymentProvider.new(parse_raw_data(row)) end end end end
default_data_file()
click to toggle source
# File lib/sepa_clearer/deutsche_bundesbank.rb, line 29 def default_data_file File.join(File.dirname(__FILE__), '../..', 'data/deutsche_bundesbank.csv') end
parse_raw_data(data)
click to toggle source
# File lib/sepa_clearer/deutsche_bundesbank.rb, line 22 def parse_raw_data(data) MAPPING.reduce({}) { |hsh,(key, service)| hsh[service] = (data[key] == '1'); hsh }.merge({ name: data[:name].strip.chomp, bic: data[:bic].strip.chomp, }) end