I have a post happening to a rails application from a ruby script. The script creates a variable request as
request = Net::HTTP::Post.new(url.path) >
request = Net::HTTP::Post.new(url.path)
If anyone is still facing timeout setting issue and Net::HTTP timeout not working as expected, then you may follow below approach as well:
Net::HTTP
begin Timeout::timeout(10) { #### ## YOUR REQUEST CODE WILL BE HERE #### } rescue 408 end