Sha256: 3a5b5dad44cb524d7398428d680c05e039fb7aa6085caa7617959fb05e5debcf

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

require 'rest-client'
require 'banks/fio.rb'
require 'banks/csas.rb'

class CzechBanksParser
  def initialize(token, bank, opts = {})
    @opts = opts
    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

  def config(state)
    case state
      when 'csas'
        {
          base_uri: 'https://api.csas.cz/sandbox/webapi/api/v1',
          auth_uri: 'https://api.csas.cz/sandbox/widp/oauth2/auth',
          token_uri: 'https://api.csas.cz/sandbox/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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
czech_banks_parser-0.0.1 lib/czech_banks_parser.rb