Class: CamtParser::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/camt_parser/general/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_data) ⇒ Account

Returns a new instance of Account.



6
7
8
# File 'lib/camt_parser/general/account.rb', line 6

def initialize(xml_data)
  @xml_data = xml_data
end

Instance Attribute Details

#xml_dataObject (readonly)

Returns the value of attribute xml_data.



4
5
6
# File 'lib/camt_parser/general/account.rb', line 4

def xml_data
  @xml_data
end

Instance Method Details

#account_numberString

Returns:



21
22
23
# File 'lib/camt_parser/general/account.rb', line 21

def 
  !iban.nil? && !iban.empty? ? iban : other_id
end

#bank_nameString

Returns:



34
35
36
# File 'lib/camt_parser/general/account.rb', line 34

def bank_name
  @bank_name ||= xml_data.xpath('Svcr/FinInstnId/Nm/text()').text
end

#bicString

Returns:



26
27
28
29
30
31
# 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

#currencyString

Returns:



39
40
41
# File 'lib/camt_parser/general/account.rb', line 39

def currency
  @currency ||= xml_data.xpath('Ccy/text()').text
end

#ibanString

Returns:



11
12
13
# File 'lib/camt_parser/general/account.rb', line 11

def iban
  @iban ||= xml_data.xpath('Id/IBAN/text()').text
end

#other_idString

Returns:



16
17
18
# File 'lib/camt_parser/general/account.rb', line 16

def other_id
  @other_id ||= xml_data.xpath('Id/Othr/Id/text()').text
end