Merge pull request #175 from Christian-G/master
authorSteve Bazyl <sqrrrl@gmail.com>
Sat, 6 Dec 2014 00:50:25 +0000 (16:50 -0800)
committerSteve Bazyl <sqrrrl@gmail.com>
Sat, 6 Dec 2014 00:50:25 +0000 (16:50 -0800)
Added HTTP Proxy support

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