kt 0.3.1 → 0.4.0
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.
- checksums.yaml +4 -4
- data/lib/kt.rb +19 -3
- data/lib/kt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45b09ad2578972548e2fadd526f9856d55754905
|
4
|
+
data.tar.gz: 0c7b538388ae55d883cba2eb80889c1aef01720c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d89d45cb24e2af5d012600ff3b208ba6eb0d51e2fd23da06683472ed4782cf3e1c436004c3ab7ab76172838922a1ee42a4103cae917547a96a2133a4317c6e6
|
7
|
+
data.tar.gz: e480e19ee797e6fa33c2f8d16ae4c19a3a6270778d19eea32dbff32030f2ec3c4a3e16e99f0cc7830719b5804a20aa7ec860777f9e26c1878b2acabae2bc6d3f
|
data/lib/kt.rb
CHANGED
@@ -18,9 +18,12 @@ class KT
|
|
18
18
|
@port = options.fetch(:port, 1978)
|
19
19
|
@poolsize = options.fetch(:poolsize, 5)
|
20
20
|
@timeout = options.fetch(:timeout, 5.0)
|
21
|
+
@connect_timeout = options.fetch(:connect_timeout, 0.5)
|
22
|
+
@read_timeout = options.fetch(:read_timeout, 0.5)
|
23
|
+
@write_timeout = options.fetch(:write_timeout, 0.5)
|
21
24
|
|
22
25
|
@pool = ConnectionPool.new(size: @poolsize, timeout: @timeout) do
|
23
|
-
Excon.new("http://#{@host}:#{@port}")
|
26
|
+
Excon.new("http://#{@host}:#{@port}", :connect_timeout => @connect_timeout)
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
@@ -312,7 +315,13 @@ class KT
|
|
312
315
|
headers = {"Content-Type" => encoding}
|
313
316
|
|
314
317
|
@pool.with do |conn|
|
315
|
-
res = conn.post(
|
318
|
+
res = conn.post(
|
319
|
+
:path => path,
|
320
|
+
:headers => headers,
|
321
|
+
:body => body,
|
322
|
+
:read_timeout => @read_timeout,
|
323
|
+
:write_timeout => @write_timeout,
|
324
|
+
)
|
316
325
|
# return res.status_code, decode_values(res.body, res.headers.get("Content-Type").join("; "))
|
317
326
|
return res.status, decode_values(res.body, res.headers["Content-Type"])
|
318
327
|
end
|
@@ -320,7 +329,14 @@ class KT
|
|
320
329
|
|
321
330
|
def do_rest(method, key, value="")
|
322
331
|
@pool.with do |conn|
|
323
|
-
res = conn.request(
|
332
|
+
res = conn.request(
|
333
|
+
:method => method,
|
334
|
+
:path => url_encode(key),
|
335
|
+
:headers => EMPTY_HEADERS,
|
336
|
+
:body => value,
|
337
|
+
:read_timeout => @read_timeout,
|
338
|
+
:write_timeout => @write_timeout,
|
339
|
+
)
|
324
340
|
return res.status, res.body
|
325
341
|
end
|
326
342
|
end
|
data/lib/kt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teodor Pripoae
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|