Class: CamtParser::Creditor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_data) ⇒ Creditor

Returns a new instance of Creditor.



6
7
8
# File 'lib/camt_parser/general/creditor.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/creditor.rb', line 4

def xml_data
  @xml_data
end

Instance Method Details

#bank_nameObject



28
29
30
# File 'lib/camt_parser/general/creditor.rb', line 28

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

#bicObject



21
22
23
24
25
26
# File 'lib/camt_parser/general/creditor.rb', line 21

def bic
  @bic ||= [
    xml_data.xpath('RltdAgts/CdtrAgt/FinInstnId/BIC/text()').text,
    xml_data.xpath('RltdAgts/CdtrAgt/FinInstnId/BICFI/text()').text,
  ].reject(&:empty?).first.to_s
end

#ibanObject



17
18
19
# File 'lib/camt_parser/general/creditor.rb', line 17

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

#nameObject



10
11
12
13
14
15
# File 'lib/camt_parser/general/creditor.rb', line 10

def name
  @name ||= [
    xml_data.xpath('RltdPties/Cdtr/Nm/text()').text,
    xml_data.xpath('RltdPties/Cdtr/Pty/Nm/text()').text,
  ].reject(&:empty?).first.to_s
end