require 'net/http'
require 'uri'
Parse URL.
uri = URI.parse(url)
Build a Net::HTTP
instance.
http = ::Net::HTTP.new(uri.host, uri.port)
Configure the request.
http.use_ssl = true
http.ssl_version = :TLSv1_2
http.ciphers = ['ECDHE-RSA-AES128-GCM-SHA256']
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
Optionally, set the certificate and/or key.
cert = Rails.root.join('path/to/certificate/file.cer').read
http.cert = OpenSSL::X509::Certificate.new(cert)
pem = Rails.root.join('path/to/pem/file.pem').read
http.key = OpenSSL::PKey::RSA.new(pem, nil)