module AqBanking

Constants

CMD_ARGS
GLOBAL_ARGS
VERSION

Public Class Methods

aqcli(command, options = {}) click to toggle source
# File lib/aqbanking.rb, line 63
def aqcli(command, options = {})
  options = {
    pinfile: nil,
    acceptvalidcerts: true,
    noninteractive: true,
    charset: 'utf-8',
    cfgdir: AqBanking.config
  }.merge(options)
  [
   'aqbanking-cli',
   generate_arguments(options, GLOBAL_ARGS),
   command,
   generate_arguments(options, CMD_ARGS)
  ].join(' ').strip
end
aqhbci(command, options = {}) click to toggle source
# File lib/aqbanking.rb, line 47
def aqhbci(command, options = {})
  options = {
    pinfile: nil,
    acceptvalidcerts: true,
    noninteractive: true,
    charset: 'utf-8',
    cfgfile: AqBanking.config
  }.merge(options)
  [
   'aqhbci-tool4',
   generate_arguments(options, GLOBAL_ARGS),
   command,
   generate_arguments(options, CMD_ARGS)
  ].join(' ').strip
end
config() click to toggle source
# File lib/aqbanking.rb, line 30
def config
  @config ||= '.'
end
config=(path) click to toggle source
# File lib/aqbanking.rb, line 26
def config=(path)
  @config = path
end
with_secure_pin(user, pin) { |f| ... } click to toggle source
# File lib/aqbanking.rb, line 34
def with_secure_pin(user, pin, &block)
  f = Tempfile.new("pin_#{user.bank}_#{user.user_id}", '/tmp')
  File.chmod(0400, f.path)

  f.write "PIN_#{user.bank}_#{user.user_id} = \"#{pin}\"\n"
  f.flush

  yield f if block_given?

  f.close
  f.unlink
end

Private Class Methods

generate_arguments(hash, args) click to toggle source
# File lib/aqbanking.rb, line 80
def generate_arguments(hash, args)
  args.keys.map do |key|
    if args[key] == :flag && hash[key]
      "--#{key.to_s}"
    elsif args[key] == :value && hash[key]
      "--#{key.to_s}=#{Shellwords.escape(hash[key])}"
    end
  end.compact.join(' ')
end