Class: BankScrap::Bank
- Inherits:
-
Object
- Object
- BankScrap::Bank
- Defined in:
- lib/bank_scrap/bank.rb
Constant Summary collapse
- WEB_USER_AGENT =
'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19'
Instance Attribute Summary collapse
-
#accounts ⇒ Object
Returns the value of attribute accounts.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #account_with_iban(iban) ⇒ Object
-
#fetch_accounts ⇒ Object
Interface method placeholders.
- #fetch_transactions_for(account, start_date: Date.today - 1.month, end_date: Date.today) ⇒ Object
-
#initialize(user, password, log: false, debug: false, extra_args: nil) ⇒ Bank
constructor
A new instance of Bank.
Constructor Details
#initialize(user, password, log: false, debug: false, extra_args: nil) ⇒ Bank
Returns a new instance of Bank.
10 11 12 |
# File 'lib/bank_scrap/bank.rb', line 10 def initialize(user, password, log: false, debug: false, extra_args: nil) @accounts = fetch_accounts end |
Instance Attribute Details
#accounts ⇒ Object
Returns the value of attribute accounts.
8 9 10 |
# File 'lib/bank_scrap/bank.rb', line 8 def accounts @accounts end |
#headers ⇒ Object
Returns the value of attribute headers.
8 9 10 |
# File 'lib/bank_scrap/bank.rb', line 8 def headers @headers end |
Instance Method Details
#account_with_iban(iban) ⇒ Object
24 25 26 |
# File 'lib/bank_scrap/bank.rb', line 24 def account_with_iban(iban) accounts.find { |account| account.iban.gsub(' ','') == iban.gsub(' ','') } end |
#fetch_accounts ⇒ Object
Interface method placeholders
16 17 18 |
# File 'lib/bank_scrap/bank.rb', line 16 def fetch_accounts raise Exception.new "#{self.class} should implement a fetch_account method" end |
#fetch_transactions_for(account, start_date: Date.today - 1.month, end_date: Date.today) ⇒ Object
20 21 22 |
# File 'lib/bank_scrap/bank.rb', line 20 def fetch_transactions_for(account, start_date: Date.today - 1.month, end_date: Date.today) raise Exception.new "#{self.class} should implement a fetch_transactions method" end |