Module: KontoAPI
Constant Summary collapse
- RootCA =
'/etc/ssl/certs'
- 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?(options = {}) ⇒ Boolean
Instance Method Details
#api_key ⇒ Object
19 20 21 |
# File 'lib/kontoapi-ruby.rb', line 19 def api_key @@api_key end |
#api_key=(key) ⇒ Object
16 17 18 |
# File 'lib/kontoapi-ruby.rb', line 16 def api_key=(key) @@api_key = key end |
#bank_name(bank_code) ⇒ Object
37 38 39 40 41 |
# File 'lib/kontoapi-ruby.rb', line 37 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
27 28 29 |
# File 'lib/kontoapi-ruby.rb', line 27 def timeout @@timeout || DEFAULT_TIMEOUT end |
#timeout=(new_timeout) ⇒ Object
24 25 26 |
# File 'lib/kontoapi-ruby.rb', line 24 def timeout=(new_timeout) @@timeout = new_timeout end |
#valid?(options = {}) ⇒ Boolean
31 32 33 34 35 |
# File 'lib/kontoapi-ruby.rb', line 31 def valid?(={}) return false unless (![:ktn].to_s.strip.empty? && ![:blz].to_s.strip.empty?) || ![:iban].to_s.strip.empty? || ![:bic].to_s.strip.empty? response = ask_for(:validity, ) response['answer'].eql?('yes') end |