Added HTTP Proxy support
authorChristian-G <gijtenbeek@terena.org>
Wed, 3 Dec 2014 14:52:00 +0000 (15:52 +0100)
committerChristian-G <gijtenbeek@terena.org>
Wed, 3 Dec 2014 14:52:00 +0000 (15:52 +0100)
lib/google/api_client.rb

index c79c71b58bf1ce05552e2d5f2a6119b5dd823cda..50aeeefe901fc0e193414b24c0c0cc140895c001 100644 (file)
@@ -97,6 +97,9 @@ module Google
       else
         logger.warn { "#{self.class} - Please provide :application_name and :application_version when initializing the client" }
       end
+
+      proxy = options[:proxy] || Object::ENV["http_proxy"]
+
       self.user_agent = options[:user_agent] || (
         "#{application_string} " +
         "google-api-ruby-client/#{Google::APIClient::VERSION::STRING} #{ENV::OS_VERSION} (gzip)"
@@ -118,6 +121,7 @@ module Google
         faraday.options.params_encoder = Faraday::FlatParamsEncoder
         faraday.ssl.ca_file = ca_file
         faraday.ssl.verify = true
+        faraday.proxy proxy
         faraday.adapter Faraday.default_adapter
       end
       return self