Class: BankScrap::Bank

Inherits:
Object
  • Object
show all
Defined in:
lib/bank_scrap/bank.rb

Direct Known Subclasses

Bankinter, Bbva, Ing

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

Instance Method Summary collapse

Constructor Details

#initialize(user, password, log: false, debug: false, extra_args: nil) ⇒ Bank

Returns a new instance of Bank.



9
10
11
# File 'lib/bank_scrap/bank.rb', line 9

def initialize(user, password, log: false, debug: false, extra_args: nil)
  @accounts    = fetch_accounts
end

Instance Attribute Details

#accountsObject

Returns the value of attribute accounts.



7
8
9
# File 'lib/bank_scrap/bank.rb', line 7

def accounts
  @accounts
end

#headersObject

Returns the value of attribute headers.



7
8
9
# File 'lib/bank_scrap/bank.rb', line 7

def headers
  @headers
end

#investmentsObject

Returns the value of attribute investments.



7
8
9
# File 'lib/bank_scrap/bank.rb', line 7

def investments
  @investments
end

Instance Method Details

#account_with_iban(iban) ⇒ Object



27
28
29
30
31
# File 'lib/bank_scrap/bank.rb', line 27

def (iban)
  accounts.find do ||
    .iban.gsub(' ', '') == iban.gsub(' ', '')
  end
end

#fetch_accountsObject

Interface method placeholders



15
16
17
# File 'lib/bank_scrap/bank.rb', line 15

def fetch_accounts
  fail "#{self.class} should implement a fetch_account method"
end

#fetch_investmentsObject



19
20
21
# File 'lib/bank_scrap/bank.rb', line 19

def fetch_investments
  fail "#{self.class} should implement a fetch_investment method"
end

#fetch_transactions_forObject



23
24
25
# File 'lib/bank_scrap/bank.rb', line 23

def fetch_transactions_for(*)
  fail "#{self.class} should implement a fetch_transactions method"
end