Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Report out balance as a comment at end of the file |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
565270916fa5b81b03158359d3a782b4 |
| User & Date: | atomicules 2015-07-07 22:19:18 |
Context
|
2015-07-10
| ||
| 10:42 | Merge in the cascaded_methods approach. I've decided I prefer that check-in: 6a191c53d1 user: atomicules tags: trunk | |
|
2015-07-07
| ||
| 22:19 | Report out balance as a comment at end of the file check-in: 565270916f user: atomicules tags: trunk | |
|
2015-07-04
| ||
| 13:36 |
Fix sorting/ordering of transactions
Need to get things in the right order for checking whether we've gone far Also add appropriate Expenses/Income placeholder check-in: 5bdd7b804f user: atomicules tags: trunk | |
Changes
Changes to smile.rb.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
require 'optparse'
require 'mechanize'
require 'nokogiri'
optparse = OptionParser.new do |opts|
opts.on('-d', '--date DATE', "Date") { |d| Date_back = d }
end
optparse.parse!
class Smile
attr_writer :date_back
attr_reader :page
attr_reader :transactions
def initialize
@a = Mechanize.new
@transactions = []
end
| > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
require 'optparse'
require 'mechanize'
require 'nokogiri'
optparse = OptionParser.new do |opts|
opts.on('-d', '--date DATE', "Date") { |d| Date_back = d }
end
optparse.parse!
class Smile
attr_writer :date_back
attr_reader :page
attr_reader :transactions
attr_reader :balance
def initialize
@a = Mechanize.new
@transactions = []
end
|
| ︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | end end def recent_transactions @page = @a.click(@page.link_with(:text => "current account")) get_transactions end def previous_statements #Previous statements @page = @a.click(@page.link_with(:text => "previous statements")) #Get first page of previous statements | > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
end
end
def recent_transactions
@page = @a.click(@page.link_with(:text => "current account"))
get_transactions
doc = Nokogiri::HTML(@page.body)
@balance = doc.xpath("//td[@class='recentTransactionsAccountData']/table/tr[2]/td[2]").text
end
def previous_statements
#Previous statements
@page = @a.click(@page.link_with(:text => "previous statements"))
#Get first page of previous statements
|
| ︙ | ︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 152 | amount = transaction[:credit] type = "Income:" end file << "\t"+"Assets:Smile:Current"+"\t"+amount+"\n" file << "\t"+type+"\n" file << "\n" end end end private :logon_start private :logon_passcode private :logon_other private :logon_bulletin | > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | amount = transaction[:credit] type = "Income:" end file << "\t"+"Assets:Smile:Current"+"\t"+amount+"\n" file << "\t"+type+"\n" file << "\n" end #Write out account balance as a comment at the end file << "#Balance: "+@balance+"\n" end end private :logon_start private :logon_passcode private :logon_other private :logon_bulletin |
| ︙ | ︙ |