Class: Ofx::Statement
- Inherits:
-
Object
- Object
- Ofx::Statement
- Defined in:
- lib/ofx.rb
Instance Method Summary collapse
-
#initialize(statement) ⇒ Statement
constructor
A new instance of Statement.
- #to_xml ⇒ Object
Constructor Details
#initialize(statement) ⇒ Statement
Returns a new instance of Statement.
5 6 7 8 |
# File 'lib/ofx.rb', line 5 def initialize(statement) @statement = statement @xml = nil end |
Instance Method Details
#to_xml ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ofx.rb', line 9 def to_xml @xml ||= ( buffer = '' builder = Builder::XmlMarkup.new(:target => buffer, :indent => 2) builder.instruct! builder << "<?OFX OFXHEADER=\"200\" VERSION=\"200\" SECURITY=\"NONE\" OLDFILEUID=\"NONE\" NEWFILEUID=\"NONE\"?>\n" builder.OFX do builder.CREDITCARDMSGSRSV1 do builder.CCSTMTTRNRS do builder.CCSTMTRS do builder.CURDEF @statement.account_currency builder.CCACCTFROM do builder.ACCTID @statement.account_number end builder.BANKTRANLIST do builder.DTSTART @statement.from_date builder.DTEND @statement.to_date @statement.transactions.each do |transaction| builder.STMTTRN do builder.TRNTYPE transaction.type builder.DTPOSTED transaction.date builder.NAME transaction.payee builder.MEMO transaction.note builder.TRNAMT transaction.amount builder.FITID transaction.ofx_id end end end builder.LEDGERBAL do builder.BALAMT @statement.closing_balance builder.DTASOF @statement.to_date end end end end end buffer ) end |