Changeset 1056 for easyweb

Show
Ignore:
Timestamp:
09/07/08 21:19:52 (18 months ago)
Author:
vasi
Message:

interface done

Location:
easyweb/trunk/lib
Files:
2 added
1 modified

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) }  
     1require 'date' 
     2 
     3# A banking account on EasyWeb 
     4class 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) 
    814        end 
    9 end 
     15end      
    1016 
    11 class EasyWeb::Account   
     17 
     18__END__ 
     19 
     20#### OLD #### 
     21 
    1222        attr_reader :easyweb, :id, :elem 
    1323        attr_reader :activity_type # 'C' for regular, 'V' for credit 
     
    4858        def creditcard?; activity_type == 'V'; end 
    4959end 
     60 
     61class 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 
     69end 
     70