Smile Bank to Ledger

Check-in [d3dd543406]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Skip header and footer rows on recent items
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d3dd5434069e8047402d2521a4719a09bee50222
User & Date: atomicules 2015-06-28 10:59:05
Context
2015-07-01
11:34
Add basics for writing out transactions in Ledger format check-in: 16678c4f5f user: atomicules tags: trunk
2015-06-28
10:59
Skip header and footer rows on recent items check-in: d3dd543406 user: atomicules tags: trunk
2015-06-27
20:20
Actual initial commit of file check-in: 649373d472 user: atomicules tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to smile.rb.

43
44
45
46
47
48
49
50
51
52
53


54


55
56
57
58
59

60
61
62
63

64
65
66
67
68
69


page = a.click(page.link_with(:text => "current account"))

#recent items
doc = Nokogiri::HTML(page.body)
#Look for summaryTable
rows = doc.xpath("//table[@class='summaryTable']//tr")
#Do something with that!
#TODO: Might need to skip a header row
#TODO: and footer rows, not sure how to yet. Need to check JS code I did.
#array of hashes?
transactions = []


rows.each do |row|


	date = row.elements[0].text
	name = row.children[1].text
	credit = row.children[2].text
	debit = row.children[3].text
	transactions << { :date => date, :name => name, :credit => credit, :debit => debit}

end	

#TODO: Need to figure out a way to get input for number of previous pages required. Well, a good way, perhaps limit by a date?
puts "Enter date back to fetch transactions to"

date_limit = gets.strip #.convert_to_date

#Previous statements
page = a.click(page.link_with(:text => "previous statements"))

#TODO: Then need to click the top most page and go back through each page.









<
<


>
>

>
>
|
|
|
|
|
>




>






>
>
43
44
45
46
47
48
49


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
page = a.click(page.link_with(:text => "current account"))

#recent items
doc = Nokogiri::HTML(page.body)
#Look for summaryTable
rows = doc.xpath("//table[@class='summaryTable']//tr")
#Do something with that!


#array of hashes?
transactions = []
#Skip first row (ths)
rows = rows[1..-1]
rows.each do |row|
	#Skip last row, maybe
	unless row.elements.length == 1
		date = row.elements[0].text
		name = row.elements[1].text
		credit = row.elements[2].text
		debit = row.elements[3].text
		transactions << { :date => date, :name => name, :credit => credit, :debit => debit}
	end
end	

#TODO: Need to figure out a way to get input for number of previous pages required. Well, a good way, perhaps limit by a date?
puts "Enter date back to fetch transactions to"
#Assume ISO thingy format
date_limit = gets.strip #.convert_to_date

#Previous statements
page = a.click(page.link_with(:text => "previous statements"))

#TODO: Then need to click the top most page and go back through each page.