In Ruby 2.0.0 and later, just passing a uri object with an https URL is enough to execute an HTTPS request.
uri = URI('https://encrypted.google.com') Net::HTTP.get(uri)
You can verify this by completing a request for an expired certificate.
uri = URI('https://expired.badssl.com/') Net::HTTP.get(uri) # OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
It was introduced by this commit in Ruby 2.0.0.
The get_response method, which is called by the Net::HTTP.get , sets :use_ssl to true when uri.scheme "HTTPS".
Disclaimer: I understand that the question is about Ruby 1.8.7, but since this is one of the best search results when you search for "https ruby", I decided to answer anyway.
Jason Yeo Apr 11 '16 at 8:48 2016-04-11 08:48
source share