Not able to submit form using rails


#1
require "net/http"
require "net/https"
require "uri"
uri = URI.parse("https://forms.hubspot.com/uploads/form/v2/{portalId}/{formGuid}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/x-www-form-urlencoded')
request.set_form_data({"firstname" => "sunil325", "lastname"=>"test", "email" => "sunil325%40test.com", "phone" => "1234567890", "company" => "testc", "hs_context"=>"%7B%22hutk%22%3A%22abc%22%2C%22ipAddress%22%3A%22192.168.0.187%22%2C%22pageUrl%22%3A%22http%3A%5C%2F%5C%2Fwww.example.com%5C%2Fform-page%22%2C%22pageName%22%3A%22Example+Title%22%7D302"})
response = http.request(request)
Rails.logger.info "_______________________________#{response.inspect}_______________________________________ "

#2

What is the response code you are receiving? If you are receiving an error message, can you please post the full error.