Class: SepaFileParser::CreditorReferenceInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/sepa_file_parser/general/creditor_reference_information.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_data) ⇒ CreditorReferenceInformation

Returns a new instance of CreditorReferenceInformation.



8
9
10
# File 'lib/sepa_file_parser/general/creditor_reference_information.rb', line 8

def initialize(xml_data)
  @xml_data = xml_data
end

Instance Attribute Details

#xml_dataObject (readonly)

Returns the value of attribute xml_data.



6
7
8
# File 'lib/sepa_file_parser/general/creditor_reference_information.rb', line 6

def xml_data
  @xml_data
end

Instance Method Details

#code_or_proprietaryObject



16
17
18
19
20
21
# File 'lib/sepa_file_parser/general/creditor_reference_information.rb', line 16

def code_or_proprietary
  @code_or_proprietary ||= [
    xml_data.xpath('Tp/CdOrPrtry/Cd/text()').text,
    xml_data.xpath('Tp/CdOrPrtry/Prtry/text()').text,
  ].reject(&:empty?).first.to_s
end

#creditor_referenceObject



12
13
14
# File 'lib/sepa_file_parser/general/creditor_reference_information.rb', line 12

def creditor_reference
  @creditor_reference ||= xml_data.xpath('Ref/text()').text
end