Module: KontoAPI
Constant Summary collapse
- VALIDITY_URL =
Addressable::URI.parse 'https://ask.kontoapi.de/for/validity.json'
- BANKNAME_URL =
Addressable::URI.parse 'https://ask.kontoapi.de/for/bankname.json'
- DEFAULT_TIMEOUT =
10
- @@api_key =
nil
- @@timeout =
nil
Instance Method Summary collapse
- #api_key ⇒ Object
- #api_key=(key) ⇒ Object
- #bank_name(bank_code) ⇒ Object
- #timeout ⇒ Object
- #timeout=(new_timeout) ⇒ Object
- #valid?(account_number, bank_code) ⇒ Boolean
Instance Method Details
#api_key ⇒ Object
18 19 20 |
# File 'lib/kontoapi-ruby.rb', line 18 def api_key @@api_key end |
#api_key=(key) ⇒ Object
15 16 17 |
# File 'lib/kontoapi-ruby.rb', line 15 def api_key=(key) @@api_key = key end |
#bank_name(bank_code) ⇒ Object
36 37 38 39 40 |
# File 'lib/kontoapi-ruby.rb', line 36 def bank_name(bank_code) return nil if bank_code.to_s.strip.empty? response = ask_for(:bankname, { :blz => bank_code.to_s }) response['answer'].empty? ? nil : response['answer'] end |
#timeout ⇒ Object
26 27 28 |
# File 'lib/kontoapi-ruby.rb', line 26 def timeout @@timeout || DEFAULT_TIMEOUT end |
#timeout=(new_timeout) ⇒ Object
23 24 25 |
# File 'lib/kontoapi-ruby.rb', line 23 def timeout=(new_timeout) @@timeout = new_timeout end |
#valid?(account_number, bank_code) ⇒ Boolean
30 31 32 33 34 |
# File 'lib/kontoapi-ruby.rb', line 30 def valid?(account_number, bank_code) return false if account_number.to_s.strip.empty? || bank_code.to_s.strip.empty? response = ask_for(:validity, { :ktn => account_number.to_s, :blz => bank_code.to_s }) response['answer'].eql?('yes') end |