http.use_ssl = true
it should be false
as you call http
It should be
http.use_ssl = false
secondly
You're trying to pass a Hash, {"auth_token"=>"abcd" ,"employee" => {"method" => "add_employee"}}
, to post where it expects to see a String. I think you want something more like this:
query = {"auth_token"=>"abcd" ,"employee" => {"method" => "add_employee"}}.to_query
it will create string like this "auth_token=abcd&employee%5Bmethod%5D=add_employee"
you have to send this to post
http.post(uri.path, query, headers)
Please try this
require 'net/http'
uri = URI.parse("http://webaddress.com/v1.1/auth")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = false
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.post(uri.path,{"auth_token"=>"abcd", "employee" => {"method" => "add_employee"}}.to_query)
Look at the below links for more
http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTP.html#method-i-post
[33] pry(main)> uri = URI.parse("http://webaddress.com/v1.1/auth")
=> #<URI::HTTP:0x000000098f9928 URL:http://webaddress.com/v1.1/auth>
[34] pry(main)> http = Net::HTTP.new(uri.host, uri.port)
=> #<Net::HTTP webaddress.com:80 open=false>
[35] pry(main)> http.use_ssl = false
=> false
[36] pry(main)> http.verify_mode = OpenSSL::SSL::VERIFY_NONE
=> 0
[38] pry(main)> response = http.post(uri.path,{"auth_token"=>"abcd", "employee" => {"method" => "add_employee"}}.to_query)
=> #<Net::HTTPFound 302 Found readbody=true>
[39] pry(main)> response.body
=> ""
http.use_ssl = true
it should befalse
as you callhttp
– Rajarshi Dasrequest.body = {"auth_token"=>"abcd" ,"employee" => {"method" => "add_employee"}
for this – Rajarshi Das