Class: CamtParser::Debitor
- Inherits:
-
Object
- Object
- CamtParser::Debitor
- Defined in:
- lib/camt_parser/general/debitor.rb
Instance Attribute Summary collapse
-
#xml_data ⇒ Object
readonly
Returns the value of attribute xml_data.
Instance Method Summary collapse
- #bank_name ⇒ Object
- #bic ⇒ Object
- #iban ⇒ Object
-
#initialize(xml_data) ⇒ Debitor
constructor
A new instance of Debitor.
- #name ⇒ Object
- #postal_address ⇒ CamtParser::PostalAddress?
Constructor Details
#initialize(xml_data) ⇒ Debitor
Returns a new instance of Debitor.
6 7 8 |
# File 'lib/camt_parser/general/debitor.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/debitor.rb', line 4 def xml_data @xml_data end |
Instance Method Details
#bank_name ⇒ Object
28 29 30 |
# File 'lib/camt_parser/general/debitor.rb', line 28 def bank_name @bank_name ||= xml_data.xpath('RltdAgts/DbtrAgt/FinInstnId/Nm/text()').text end |
#bic ⇒ Object
21 22 23 24 25 26 |
# File 'lib/camt_parser/general/debitor.rb', line 21 def bic @bic ||= [ xml_data.xpath('RltdAgts/DbtrAgt/FinInstnId/BIC/text()').text, xml_data.xpath('RltdAgts/DbtrAgt/FinInstnId/BICFI/text()').text, ].reject(&:empty?).first.to_s end |
#iban ⇒ Object
17 18 19 |
# File 'lib/camt_parser/general/debitor.rb', line 17 def iban @iban ||= xml_data.xpath('RltdPties/DbtrAcct/Id/IBAN/text()').text end |
#name ⇒ Object
10 11 12 13 14 15 |
# File 'lib/camt_parser/general/debitor.rb', line 10 def name @name ||= [ xml_data.xpath('RltdPties/Dbtr/Nm/text()').text, xml_data.xpath('RltdPties/Dbtr/Pty/Nm/text()').text, ].reject(&:empty?).first.to_s end |
#postal_address ⇒ CamtParser::PostalAddress?
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/camt_parser/general/debitor.rb', line 33 def postal_address # May be missing postal_address = [ xml_data.xpath('RltdPties/Dbtr/PstlAdr'), xml_data.xpath('RltdPties/Dbtr/Pty/PstlAdr'), ].reject(&:empty?).first return nil if postal_address == nil || postal_address.empty? @address ||= CamtParser::PostalAddress.new(postal_address) end |