class CzechBanksParser

Public Class Methods

new(opts = {}) click to toggle source
# File lib/czech_banks_parser.rb, line 6
def initialize(opts = {})
  @opts = opts
end

Public Instance Methods

config(state) click to toggle source
# File lib/czech_banks_parser.rb, line 18
def config(state)
  case state
    when 'csas'
      {
        base_uri: @opts[:mode] == 'production' ? '' : 'https://www.csast.csas.cz/webapi/api/v3',
        auth_uri: @opts[:mode] == 'production' ? '' : 'https://www.csast.csas.cz/widp/oauth2/auth',
        token_uri: @opts[:mode] == 'production' ? '' : 'https://www.csast.csas.cz/widp/oauth2/token',
        client_id: @opts[:client_id],
        secret: @opts[:secret],
        web_api_key: @opts[:web_api_key]
      }
    when 'fio'
      {
        base_uri: 'https://www.fio.cz/ib_api/rest'
      }
  end
end
connect(token, bank) click to toggle source
# File lib/czech_banks_parser.rb, line 10
def connect(token, bank)
  case bank
    when 'csas' then Banks::Csas.new(token, config('csas'))
    when 'fio' then Banks::Fio.new(token, config('fio'))
    else raise(NotImplementedError)
  end
end