From c2f25b471dc1ac5c7ee123aa9d51f44384a4f3d1 Mon Sep 17 00:00:00 2001 From: Cody Fauser Date: Thu, 18 Sep 2008 11:39:52 -0400 Subject: [PATCH] Add configurable timeouts from Active Merchant --- CHANGELOG | 1 + lib/active_shipping/lib/posts_data.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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