diff --git a/lib/geocoder/lookups/google.rb b/lib/geocoder/lookups/google.rb
index 8483f137869f0c6038dd6d5ccc12c02907d52665..4c8157069529ee9bf10532968d5a0fe331f030c2 100644
--- a/lib/geocoder/lookups/google.rb
+++ b/lib/geocoder/lookups/google.rb
@@ -30,7 +30,11 @@ module Geocoder::Lookup
     def configure_ssl!(client)
       client.instance_eval {
         @ssl_context = OpenSSL::SSL::SSLContext.new
-        @ssl_context.set_params({:options=> OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3 | OpenSSL::SSL::OP_NO_COMPRESSION})
+        options = OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
+        if OpenSSL::SSL.const_defined?('OP_NO_COMPRESSION')
+          options |= OpenSSL::SSL::OP_NO_COMPRESSION
+        end
+        @ssl_context.set_params({options: options})
       }
     end