Class: BankCredentials::Hbci

Inherits:
Base
  • Object
show all
Defined in:
lib/bank_credentials/hbci.rb

Defined Under Namespace

Modules: Errors

Constant Summary collapse

BANK_LIST =
File.join(File.dirname(__FILE__), '../bank_list.json')

Instance Attribute Summary

Attributes inherited from Base

#credentials

Instance Method Summary collapse

Methods inherited from Base

attribute, attributes, #attributes, #encode, #to_json, type, #valid?, #validate!

Constructor Details

#initialize(credential_hash, options = {}) ⇒ Hbci

Returns a new instance of Hbci.



32
33
34
35
36
# File 'lib/bank_credentials/hbci.rb', line 32

def initialize(credential_hash, options = {})
  super
  @bank_list = nil
  @credentials[:url] = bank['pinTanURL'] unless @credentials[:url]
end

Instance Method Details

#bankObject

Raises:



38
39
40
41
42
# File 'lib/bank_credentials/hbci.rb', line 38

def bank
  bank = bank_list.find { |b| b['blz'] == bank_code }
  raise Errors::Config, "Bank \"#{bank_code}\" not found in bank list" unless bank
  bank
end