Class: SepaFileParser::PainEntry
- Inherits:
-
Object
- Object
- SepaFileParser::PainEntry
- Defined in:
- lib/sepa_file_parser/general/pain_entry.rb
Instance Attribute Summary collapse
-
#xml_data ⇒ Object
readonly
Returns the value of attribute xml_data.
Instance Method Summary collapse
- #account ⇒ Object
- #amount ⇒ Object
- #amount_in_cents ⇒ Object
- #currency ⇒ String
-
#initialize(xml_data) ⇒ PainEntry
constructor
A new instance of PainEntry.
- #remittance_information ⇒ Object
Constructor Details
#initialize(xml_data) ⇒ PainEntry
Returns a new instance of PainEntry.
8 9 10 11 12 13 14 15 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 8 def initialize(xml_data) @xml_data = xml_data @amount = [ xml_data.xpath('Amt/InstdAmt').first, xml_data.xpath('InstdAmt').first, ].find { |a| a != nil }.text end |
Instance Attribute Details
#xml_data ⇒ Object (readonly)
Returns the value of attribute xml_data.
6 7 8 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 6 def xml_data @xml_data end |
Instance Method Details
#account ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 33 def account @account ||= SepaFileParser::Account.from_pain_data( xml_data, currency, 'Cdtr', ) end |
#amount ⇒ Object
17 18 19 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 17 def amount SepaFileParser::Misc.to_amount(@amount) end |
#amount_in_cents ⇒ Object
21 22 23 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 21 def amount_in_cents SepaFileParser::Misc.to_amount_in_cents(@amount) end |
#currency ⇒ String
26 27 28 29 30 31 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 26 def currency @currency ||= [ xml_data.xpath('Amt/InstdAmt/@Ccy').first, xml_data.xpath('InstdAmt/@Ccy').first, ].find { |a| a != nil }.text end |
#remittance_information ⇒ Object
41 42 43 |
# File 'lib/sepa_file_parser/general/pain_entry.rb', line 41 def remittance_information @remittance_information ||= xml_data.xpath('RmtInf/Ustrd').text end |