def authenticate
      options = {
        body: "username=#{@user}&password=#{@pass}"
      }

      # Have to clear out the cookies or the old SID gets sent while requesting
      # the new SID (and it fails).
      self.class.cookies.clear

      res = self.class.post('/login', options)
      if res.success?
        token = res.headers["Set-Cookie"]
        raise QbtClientError.new("Login failed: no SID (cookie) returned") if token.nil?

        token = token.split(";")[0]
        @sid = token
      else
        raise QbtClientError.new(res)
      end
    end
def authenticate
      options = {
        body: "username=#{@user}&password=#{@pass}"
      }

      # Have to clear out the cookies or the old SID gets sent while requesting
      # the new SID (and it fails).
      self.class.cookies.clear

      res = self.class.post('/login', options)
      if res.success?
        token = res.headers["Set-Cookie"]
        raise QbtClientError.new("Login failed: no SID (cookie) returned") if token.nil?

        token = token.split(";")[0]
        @sid = token
      else
        raise QbtClientError.new(res)
      end
    end
constructor


 Authenticate with the server

 Login with username and password.
 Store returned SID cookie value used as auth token for later calls.