Monday, May 11, 2009

QuickBase autheticate ruby method bug in quickbase client library

For subsequent calls with the help of ruby quickbase api , it should consider the old token number.

Existing method :
def authenticate( username, password, hours = nil )

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

      if username and password

         @ticket = nil
         xmlRequestData = toXML( :hours, @hours ) if @hours
         sendRequest( :authenticate )
         @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

The above one missing token variable and which is very important for next or immediate calls.
so add this line in the above method.
@ticket = getResponseValue( :ticket )