Class: AqBanking::Cli
- Inherits:
-
Thor
- Object
- Thor
- AqBanking::Cli
- Defined in:
- lib/aq_banking/cli.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Cli
constructor
A new instance of Cli.
- #list_banks ⇒ Object
- #request(bank_code, account_number, user_id, password) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(*args) ⇒ Cli
Returns a new instance of Cli.
5 6 7 8 |
# File 'lib/aq_banking/cli.rb', line 5 def initialize *args super AqBanking.logger.level = Logger::DEBUG if [:verbose] end |
Instance Method Details
#list_banks ⇒ Object
48 49 50 |
# File 'lib/aq_banking/cli.rb', line 48 def list_banks BANKS.keys.map(&:to_s).each { |key| puts key } end |
#request(bank_code, account_number, user_id, password) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/aq_banking/cli.rb', line 20 def request(bank_code, account_number, user_id, password) = { server_url: server_url, bank_code: bank_code, account_number: account_number, user_id: user_id, password: password } [:hbci_version] = hbci_version if hbci_version [:from] = [:from] if [:from] [:to] = [:to] if [:to] response = commander.send_request!() account = parser.parse_account_list(response).first case [:format] when 'json' puts account.to_json when 'raw' puts account.to_raw else puts 'unknown format' end end |
#version ⇒ Object
53 54 55 |
# File 'lib/aq_banking/cli.rb', line 53 def version puts VERSION end |