require 'mysql2'

module QAHelpers
  module DataBase
    class Client
      attr_reader :client

      def initialize(params={})
        db_params = {
            host: ENV['MYSQL_HOST'],
            username: ENV['MYSQL_USER'],
            password: ENV['MYSQL_PASSWORD'],
            database: ENV['MYSQL_DATABASE']
        }
        db_params.merge!(params)
        puts "Creating connection to #{db_params[:host]} DB"
        @client = Mysql2::Client.new(db_params)
      end
    end
  end
end
