Method: Idnow::Client#initialize
- Defined in:
- lib/idnow/client.rb
#initialize(env:, company_id:, api_key:, timeout: nil, sftp_options: {}) ⇒ Client
Returns a new instance of Client.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/idnow/client.rb', line 25 def initialize(env:, company_id:, api_key:, timeout: nil, sftp_options: {}) raise 'Please set env to :test or :live' unless Idnow::ENVIRONMENTS.keys.include?(env) raise 'Please set your company_id' if company_id.nil? raise 'Please set your api_key' if api_key.nil? @host = Idnow.endpoint(env, :host) @target_host = Idnow.endpoint(env, :target_host) @company_id = company_id @api_key = api_key @http_client = HttpClient.new(host: @host) [:timeout] = timeout if timeout @sftp_client = SftpClient.new(host: @host, username: @company_id, password: @api_key, options: ) end |