hutils 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae97daa9f753f4d2ca5e40dac56ae46403d49f13
4
- data.tar.gz: ede5236d2a555615a6e4cf90f5386074f403326a
3
+ metadata.gz: f2e350576b99db40c5773e40e27db573e6f228a7
4
+ data.tar.gz: d8e8150c156d9dec9b35e0f049373daa398cb2a3
5
5
  SHA512:
6
- metadata.gz: eda70d9d6e3defea2d158964a9a9c78014d0afadbd19b22d928e40089bc4623ac2cb710b561b112d094abca8cc18264eea0c9e6c9d441050d0a4dd9071c185bd
7
- data.tar.gz: 09ef57610dd6dd8edf8ed516f96a5bbc4da8adbda33c2ce6903746d7e4846039df1ee0b8227ed9044994f7265647568ccf5b5b674718d9a85db6a2f4030487d8
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, read_timeout: timeout)
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
- JSON.parse(resp.body)
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.0
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-24 00:00:00.000000000 Z
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon