Here my HTTParty code
response = HTTParty.post(api_url,body: form_data,timeout: 5)
rescue Timeout::Error
## create dummy response with 500 error code
response = HTTParty::Response.new()
ensure
response
all I'm trying to do is ensure If the HTTParty is unable to connect the given website create a dummy response body objec
But when I try to create a dummy Response object like this
## response = HTTParty::Response.new(Rack::Request.new(api_url),Rack::Response.new('TimeOut Error',500),'TimeOutError')
but this does not work because my response object does not respond_to to_hash
Can anyone suggest a better way to accomplish the same