Class: AqBanking::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/aq_banking/cli.rb

Instance Method Summary collapse

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 options[:verbose]
end

Instance Method Details

#list_banksObject



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, , user_id, password)
  request_options = {
      server_url: server_url,
      bank_code: bank_code,
      account_number: ,
      user_id: user_id,
      password: password
  }

  request_options[:hbci_version] = hbci_version if hbci_version
  request_options[:from] = options[:from] if options[:from]
  request_options[:to] = options[:to] if options[:to]


  response = commander.send_request!(request_options)
   = parser.(response).first

  case options[:format]
  when 'json'
    puts .to_json
  when 'raw'
    puts .to_raw
  else
    puts 'unknown format'
  end
end

#versionObject



53
54
55
# File 'lib/aq_banking/cli.rb', line 53

def version
  puts VERSION
end