I have a json URL supplied by sendgrid. All it needs to be is touched. How would I do this?
def suspend
@user = User.find(params[:id])
@user.update_attribute("suspended", true)
# the url I need to touch => https://sendgrid.com/api/unsubscribes.add.xml?api_user=username%40website.com&api_key=secret_password&email=#{@user.email}
end
You can use
Net::HTTP.getfrom standard library (see docs):Updated:
For HTTPS you can do smth like that:
Nice article on the subject – Ruby Net::HTTP Cheat Sheet.