Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Add basics of getting previous statements |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b65738a784a4d14c10944f9c4b94777c |
User & Date: | atomicules 2015-07-02 20:54:34 |
2015-07-04
| ||
11:21 |
Build it into a proper script
I'm not entirely sure whether a class structure is appropriate for this. At the - I'd got credits and debits the wrong way round | |
2015-07-02
| ||
20:54 | Add basics of getting previous statements check-in: b65738a784 user: atomicules tags: trunk | |
2015-07-01
| ||
20:26 | Check for Bulletin Board sumbit check-in: 3b0a9cbf4e user: atomicules tags: trunk | |
Changes to smile.rb.
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #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" | > | > > > > | > > | 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 76 77 78 79 80 81 82 83 84 85 86 87 | #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 #TODO: Need to skip BROUGHT FORWARD as well for previous item pages 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")) #Get first page of previous statements page = a.click(page.links_with(:href => %r{getDomestic} )[0]) #TODO: get transactions in the same way #then click back #TODO: This needs to be in a loop page = a.click(page.link_with(:text => "previous statement page")) #Need someway of stopping if I call the above in a loop. So probably check dates. #Write transactions out #TODO: Might need to sort by date File.open("smile.dat", "w") do |file| transactions.each do |transaction| file << Date.parse(transaction[:date]).strftime("%Y/%m/%d")+"\t"+transaction[:name]+"\n" |
︙ | ︙ |