Class: Egg::DocumentParser

Inherits:
Object
  • Object
show all
Defined in:
lib/egg/parsers/document_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ DocumentParser

Returns a new instance of DocumentParser.



7
8
9
# File 'lib/egg/parsers/document_parser.rb', line 7

def initialize(html)
  @doc = Hpricot(html)
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



5
6
7
# File 'lib/egg/parsers/document_parser.rb', line 5

def doc
  @doc
end

Instance Method Details

#to_ofxObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/egg/parsers/document_parser.rb', line 11

def to_ofx
     = Egg::Account.new('GBP', card_number)
  statement = Egg::Statement.new(statement_date, closing_balance, )
  
  each_transaction do |transaction_row|
    next if transaction_row.skip?
    transaction = Egg::Transaction.new(transaction_row.date, transaction_row.description, transaction_row.money)
    statement.add_transaction(transaction)
  end

  Ofx::Statement.new(statement).to_xml
end