def authenticate( username, password, hours = nil )

      @username, @password, @hours = username, password, hours

      if username and password

         @ticket = nil
         if @hours
            xmlRequestData = toXML( :hours, @hours )
            sendRequest( :authenticate, xmlRequestData )
         else
            sendRequest( :authenticate )
         end
          
         @userid = getResponseValue( :userid )
         return self if @chainAPIcalls
         return @ticket, @userid

      elsif username or password
         raise "authenticate: missing username or password"
      elsif @ticket
         raise "authenticate: #{username} is already authenticated"
      end
   end
def authenticate( username, password, hours = nil )

      @username, @password, @hours = username, password, hours

      if username and password

         @ticket = nil
         if @hours
            xmlRequestData = toXML( :hours, @hours )
            sendRequest( :authenticate, xmlRequestData )
         else
            sendRequest( :authenticate )
         end
          
         @userid = getResponseValue( :userid )
         return self if @chainAPIcalls
         return @ticket, @userid

      elsif username or password
         raise "authenticate: missing username or password"
      elsif @ticket
         raise "authenticate: #{username} is already authenticated"
      end
   end
API_Authenticate