lib/oauth/oauth_consumer.rb in xero_gateway-2.1.0 vs lib/oauth/oauth_consumer.rb in xero_gateway-2.3.0
- old
+ new
@@ -1,14 +1,30 @@
module OAuth
class Consumer
-
- def http_with_ssl_client_certificates(*args)
- @http ||= http_without_ssl_client_certificates(*args).tap do |http|
- http.cert = options[:ssl_client_cert]
- http.key = options[:ssl_client_key]
+
+ if RUBY_VERSION >= "2.0.0"
+
+ # we got Module#prepend, let's use it
+ module ClientCertificateExtensions
+ def http
+ super.tap do |http|
+ http.cert = options[:ssl_client_cert]
+ http.key = options[:ssl_client_key]
+ end
+ end
end
+
+ prepend ClientCertificateExtensions
+
+ else
+ def http_with_ssl_client_certificates(*args)
+ @http ||= http_without_ssl_client_certificates(*args).tap do |http|
+ http.cert = options[:ssl_client_cert]
+ http.key = options[:ssl_client_key]
+ end
+ end
+
+ alias_method_chain :http, :ssl_client_certificates
end
-
- alias_method_chain :http, :ssl_client_certificates
-
+
end
-end
\ No newline at end of file
+end