data-sink-client 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/data-sink-client/version.rb +1 -1
- data/lib/data_sink/client.rb +10 -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: a159e46208b12b267d7ee9bd23a658202012478b
|
4
|
+
data.tar.gz: c99e16b3e44d76d8dfb7b56ef645db9c2be9ae77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf49268829d9ac8a7b71e18a267b5f80b51cb8f63259ab7bb23bb6d7ddc7de30d1bddca4300331cf81d7700b59cb8dc2ef8ef6d695f5063039c0fd420787cb55
|
7
|
+
data.tar.gz: 266eacc20cc55141e90e01fa2c7e3684b3dde0ca0744be48d9eb55014b9eeacdba856f4d8079b4c6fa734be38ccf8ade6850c10cf73dacf2661269b6d7c01a0a
|
data/README.md
CHANGED
data/lib/data_sink/client.rb
CHANGED
@@ -11,6 +11,7 @@ module DataSink
|
|
11
11
|
adapter: :excon,
|
12
12
|
read_timeout: 5,
|
13
13
|
open_timeout: 5,
|
14
|
+
add_newlines: true
|
14
15
|
}.freeze
|
15
16
|
|
16
17
|
attr_reader :client, :options
|
@@ -23,7 +24,7 @@ module DataSink
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def post(stream_id, body)
|
26
|
-
post_gzipped(stream_id, gzip(body))
|
27
|
+
post_gzipped(stream_id, gzip(transform(body)))
|
27
28
|
end
|
28
29
|
|
29
30
|
def post_gzipped(stream_id, body)
|
@@ -52,6 +53,14 @@ module DataSink
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
def transform(body)
|
57
|
+
if options[:add_newlines]
|
58
|
+
body + "\n"
|
59
|
+
else
|
60
|
+
body
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
55
64
|
def gzip(body)
|
56
65
|
wio = StringIO.new("w")
|
57
66
|
w_gz = Zlib::GzipWriter.new(wio)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-sink-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Pirlik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|