class BankAccountStatement::Outputs::OFX::V_2_1_1
OFX
2.1.1 statement generation.
Constants
- OFX_HEADER
- OFX_STRFTIME
Public Instance Methods
generate()
click to toggle source
# File lib/bank-account-statement/outputs/OFX/V_2_1_1.rb, line 20 def generate _xml = case @data[:account][:type] when :CREDITLINE _xml_credit_card else _xml_bank_statement end xml_b = _xml.to_xml.split("\n").drop(1) # :| (OFX_HEADER + xml_b).join("\n") end
Private Instance Methods
_amount(amount)
click to toggle source
# File lib/bank-account-statement/outputs/OFX/V_2_1_1.rb, line 38 def _amount(amount) amount.to_s('F') end
_time(datetime)
click to toggle source
# File lib/bank-account-statement/outputs/OFX/V_2_1_1.rb, line 34 def _time(datetime) datetime.strftime(OFX_STRFTIME) end
_xml_bank_statement()
click to toggle source
# File lib/bank-account-statement/outputs/OFX/V_2_1_1.rb, line 42 def _xml_bank_statement Nokogiri::XML::Builder.new { |x| x.OFX { x.BANKMSGSRSV1 { x.STMTTRNRS { x.STMTRS { x.CURDEF @data[:currency] x.BANKACCTFROM { x.BANKID @data[:bank][:id] x.ACCTID @data[:account][:id] x.ACCTTYPE @data[:account][:type] } x.BANKTRANLIST { @data[:transactions].each { |transaction| x.STMTTRN { x.TRNTYPE transaction[:type] x.DTPOSTED _time(transaction[:posted_at]) x.TRNAMT _amount(transaction[:amount]) x.NAME transaction[:name] } } } x.LEDGERBAL { x.BALAMT _amount(@data[:balance][:ledger][:amount]) x.DTASOF _time(@data[:balance][:ledger][:balanced_at]) } } } } } } end
_xml_credit_card()
click to toggle source
# File lib/bank-account-statement/outputs/OFX/V_2_1_1.rb, line 75 def _xml_credit_card Nokogiri::XML::Builder.new { |x| x.OFX { x.BANKMSGSRSV1 { x.CCSTMTTRNRS { x.CCSTMTRS { x.CURDEF @data[:currency] x.CCACCTFROM { x.ACCTID @data[:account][:id] } x.BANKTRANLIST { @data[:transactions].each { |transaction| x.STMTTRN { x.TRNTYPE transaction[:type] x.DTPOSTED _time(transaction[:posted_at]) x.TRNAMT _amount(transaction[:amount]) x.NAME transaction[:name] } } } x.LEDGERBAL { x.BALAMT _amount(@data[:balance][:ledger][:amount]) x.DTASOF _time(@data[:balance][:ledger][:balanced_at]) } } } } } } end