diff --git a/CHANGELOG b/CHANGELOG index e106829fe..6c7ca2b95 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add configurable timeouts from Active Merchant [cody] * Update xml_node.rb from XML Node [cody] * Update requires_parameters from ActiveMerchant [cody] * Sync posts_data.rb with ActiveMerchant [cody] diff --git a/lib/active_shipping/lib/posts_data.rb b/lib/active_shipping/lib/posts_data.rb index 0957c0fb2..28754baba 100644 --- a/lib/active_shipping/lib/posts_data.rb +++ b/lib/active_shipping/lib/posts_data.rb @@ -19,6 +19,12 @@ def self.included(base) base.class_inheritable_accessor :retry_safe base.retry_safe = false + + base.superclass_delegating_accessor :open_timeout + base.open_timeout = OPEN_TIMEOUT + + base.superclass_delegating_accessor :read_timeout + base.read_timeout = READ_TIMEOUT end def ssl_post(url, data, headers = {}) @@ -28,8 +34,8 @@ def ssl_post(url, data, headers = {}) uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) - http.open_timeout = OPEN_TIMEOUT - http.read_timeout = READ_TIMEOUT + http.open_timeout = self.class.open_timeout + http.read_timeout = self.class.read_timeout http.use_ssl = true if ssl_strict