class CamtParser::Debitor

Attributes

xml_data[R]

Public Class Methods

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

Public Instance Methods

bank_name() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/camt_parser/general/debitor.rb, line 17
def iban
  @iban ||= xml_data.xpath('RltdPties/DbtrAcct/Id/IBAN/text()').text
end
name() click to toggle source
# 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() click to toggle source

@return [CamtParser::PostalAddress, nil]

# 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