hutils 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hutils/ltap/lvat_drainer.rb +16 -2
- 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: f2e350576b99db40c5773e40e27db573e6f228a7
|
4
|
+
data.tar.gz: d8e8150c156d9dec9b35e0f049373daa398cb2a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cee552fa4d3d53c1b5fe17f8e2e74535f4e1015d1eff61fabde87ae4d03b94c679be016f3b2b26c954e399db6a9cf9d333fb5bdd0d89be3fb6c61e277c37834
|
7
|
+
data.tar.gz: bf9b38ece4fbd058c07f4b20426b5603c50d628d8a6a92d00b1931aa4adc8e502366b338825655aed700b79df629da61875568f18eba195bd6fc299c8d8d942d
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "json"
|
2
|
+
require "zlib"
|
2
3
|
|
3
4
|
module Hutils::Ltap
|
4
5
|
class LvatDrainer
|
@@ -9,7 +10,12 @@ module Hutils::Ltap
|
|
9
10
|
raise ArgumentError, "lvat does not supported `timestamps` option"
|
10
11
|
end
|
11
12
|
|
12
|
-
@api = Excon.new(url,
|
13
|
+
@api = Excon.new(url,
|
14
|
+
headers: {
|
15
|
+
"Accept-Encoding" => "gzip"
|
16
|
+
},
|
17
|
+
read_timeout: timeout
|
18
|
+
)
|
13
19
|
end
|
14
20
|
|
15
21
|
def run
|
@@ -22,7 +28,15 @@ module Hutils::Ltap
|
|
22
28
|
|
23
29
|
return [] if resp.status == 404
|
24
30
|
|
25
|
-
|
31
|
+
encoding = resp.headers["Content-Encoding"]
|
32
|
+
str = if encoding && encoding.include?("gzip")
|
33
|
+
reader = Zlib::GzipReader.new(StringIO.new(resp.body))
|
34
|
+
reader.read
|
35
|
+
else
|
36
|
+
resp.body
|
37
|
+
end
|
38
|
+
|
39
|
+
str.split("\n")
|
26
40
|
end
|
27
41
|
end
|
28
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|