Class: CamtParser::Account
- Inherits:
-
Object
- Object
- CamtParser::Account
- Defined in:
- lib/camt_parser/general/account.rb
Instance Attribute Summary collapse
-
#xml_data ⇒ Object
readonly
Returns the value of attribute xml_data.
Instance Method Summary collapse
- #account_number ⇒ String
- #bank_name ⇒ String
- #bic ⇒ String
- #currency ⇒ String
- #iban ⇒ String
-
#initialize(xml_data) ⇒ Account
constructor
A new instance of Account.
- #other_id ⇒ String
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_data ⇒ Object (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_number ⇒ String
21 22 23 |
# File 'lib/camt_parser/general/account.rb', line 21 def account_number !iban.nil? && !iban.empty? ? iban : other_id end |
#bank_name ⇒ String
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 |
#bic ⇒ String
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 |
#currency ⇒ String
39 40 41 |
# File 'lib/camt_parser/general/account.rb', line 39 def currency @currency ||= xml_data.xpath('Ccy/text()').text end |
#iban ⇒ String
11 12 13 |
# File 'lib/camt_parser/general/account.rb', line 11 def iban @iban ||= xml_data.xpath('Id/IBAN/text()').text end |
#other_id ⇒ String
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 |