- Timestamp:
- 09/07/08 21:19:52 (18 months ago)
- Location:
- easyweb/trunk/lib
- Files:
-
- 2 added
- 1 modified
-
easyweb.rb (added)
-
easyweb/account.rb (modified) (2 diffs)
-
easyweb/delegate.rb (added)
Legend:
- Unmodified
- Added
- Removed
-
easyweb/trunk/lib/easyweb/account.rb
r1027 r1056 1 class EasyWeb 2 def accounts(*names) 3 accs = account_summary.search('input[@type=checkbox]').map do |e| 4 Account.new(self, 5 e.find_repeating(:parent) { |e2| e2.name == 'tr' }) 6 end 7 names.empty? ? accs : accs.select { |a| names.include?(a.name) } 1 require 'date' 2 3 # A banking account on EasyWeb 4 class EasyWeb::Account 5 attr_reader :name # Name of the account 6 attr_reader :balance_cents # Balance, in cents 7 8 # Group assigned by EasyWeb: _Banking_, _Investment_ or _Credit_ 9 attr_reader :group 10 11 # Download an OFX record of this account for the month containing 12 # the given date 13 def download_month(date - Date.today) 8 14 end 9 end 15 end 10 16 11 class EasyWeb::Account 17 18 __END__ 19 20 #### OLD #### 21 12 22 attr_reader :easyweb, :id, :elem 13 23 attr_reader :activity_type # 'C' for regular, 'V' for credit … … 48 58 def creditcard?; activity_type == 'V'; end 49 59 end 60 61 class EasyWeb 62 def accounts(*names) 63 accs = account_summary.search('input[@type=checkbox]').map do |e| 64 Account.new(self, 65 e.find_repeating(:parent) { |e2| e2.name == 'tr' }) 66 end 67 names.empty? ? accs : accs.select { |a| names.include?(a.name) } 68 end 69 end 70
