messagebus-sdk 5.0.4 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ module MessagebusSDK
|
|
26
26
|
SCOPE_ALL = 'all'
|
27
27
|
TRUE_VALUE = 'true'
|
28
28
|
MAX_TEMPLATE_MESSAGES = 25
|
29
|
+
HTTP_READ_TIMEOUT = 60
|
29
30
|
|
30
31
|
HTTP_GET = "GET"
|
31
32
|
HTTP_POST = "POST"
|
@@ -35,6 +36,8 @@ module MessagebusSDK
|
|
35
36
|
def initialize(api_key, api_endpoint = DEFAULT_API_ENDPOINT)
|
36
37
|
@api_endpoint = api_endpoint
|
37
38
|
@api_key = api_key
|
39
|
+
@http = nil
|
40
|
+
@http_read_timeout = HTTP_READ_TIMEOUT
|
38
41
|
init_http_connection(@api_endpoint)
|
39
42
|
|
40
43
|
@results = base_response_params
|
@@ -59,6 +62,12 @@ module MessagebusSDK
|
|
59
62
|
time.strftime("%Y-%m-%dT%H:%M:%SZ")
|
60
63
|
end
|
61
64
|
|
65
|
+
def read_timeout(s)
|
66
|
+
if s > 0 and s < 600
|
67
|
+
@http_read_timeout = s
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
62
71
|
private
|
63
72
|
|
64
73
|
def init_http_connection(target_server)
|
@@ -67,9 +76,7 @@ module MessagebusSDK
|
|
67
76
|
end
|
68
77
|
@last_init_time = Time.now.utc
|
69
78
|
endpoint_url = URI.parse(target_server)
|
70
|
-
@http = Net::HTTP.
|
71
|
-
@http.use_ssl = true
|
72
|
-
@http.read_timeout = 300
|
79
|
+
@http = Net::HTTP.start(endpoint_url.host, endpoint_url.port, {:use_ssl => true, :read_timeout => @http_read_timeout})
|
73
80
|
@http
|
74
81
|
end
|
75
82
|
|
@@ -54,6 +54,17 @@ describe MessagebusSDK::MessagebusBase do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
describe "http read timeout" do
|
58
|
+
it "assigns value" do
|
59
|
+
client = MessagebusSDK::MessagebusBase.new(@api_key)
|
60
|
+
client.read_timeout(0)
|
61
|
+
client.instance_variable_get(:@http_read_timeout).should == 60
|
62
|
+
|
63
|
+
client.read_timeout(10)
|
64
|
+
client.instance_variable_get(:@http_read_timeout).should == 10
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
57
68
|
# TODO http testing for correct VERB
|
58
69
|
describe "#make_api_request" do
|
59
70
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagebus-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: SDK for Message Bus service
|
15
15
|
email:
|