class CamtParser::Account

Attributes

xml_data[R]

Public Class Methods

new(xml_data) click to toggle source
# File lib/camt_parser/general/account.rb, line 6
def initialize(xml_data)
  @xml_data = xml_data
end

Public Instance Methods

account_number() click to toggle source

@return [String]

# File lib/camt_parser/general/account.rb, line 21
def account_number
  !iban.nil? && !iban.empty? ? iban : other_id
end
bank_name() click to toggle source

@return [String]

# File lib/camt_parser/general/account.rb, line 34
def bank_name
  @bank_name ||= xml_data.xpath('Svcr/FinInstnId/Nm/text()').text
end
bic() click to toggle source

@return [String]

# File lib/camt_parser/general/account.rb, line 26
def bic
  @bic ||= [
    xml_data.xpath('Svcr/FinInstnId/BIC/text()').text,
    xml_data.xpath('Svcr/FinInstnId/BICFI/text()').text,
  ].reject(&:empty?).first.to_s
end
currency() click to toggle source

@return [String]

# File lib/camt_parser/general/account.rb, line 39
def currency
  @currency ||= xml_data.xpath('Ccy/text()').text
end
iban() click to toggle source

@return [String]

# File lib/camt_parser/general/account.rb, line 11
def iban
  @iban ||= xml_data.xpath('Id/IBAN/text()').text
end
other_id() click to toggle source

@return [String]

# File lib/camt_parser/general/account.rb, line 16
def other_id
  @other_id ||= xml_data.xpath('Id/Othr/Id/text()').text
end