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
@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 )