influxdb-client 1.4.0.pre.771 → 1.4.0.pre.827
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/.rubocop.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/influxdb2/client/default_api.rb +4 -0
- data/lib/influxdb2/client/delete_api.rb +1 -1
- data/lib/influxdb2/client/health_api.rb +1 -1
- data/lib/influxdb2/client/query_api.rb +1 -1
- data/lib/influxdb2/client/write_api.rb +1 -1
- data/test/influxdb/client_test.rb +7 -0
- data/test/influxdb/write_api_test.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f07f57cbad7ef808ff1fa63def34ff6f06f29c1b2e14b5859f9a55e9ab7398a
|
4
|
+
data.tar.gz: f4af2e128dbf11e3465c469a0899c3898c01e81b4970fdfaecb0b3e8e6e2f771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277df5a8efc57fa2a087bf2b4a45b6d2a2e54b7752df1b0ea20e445b0a34ed22690b9a5dff184db11bd7cf9df58b7cd95b0596c13374847963931d9860123de7
|
7
|
+
data.tar.gz: 6aab7f0f004344524d988502bbe8819cc959f4d3060ef4779f3bdd11dd9e6aa0b5e9b4c5efcb4faa2cfc94ae1a9c6b3327367ead9b1cecd0081f67fc68000390
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -34,6 +34,10 @@ module InfluxDB2
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
+
def _parse_uri(api_path)
|
38
|
+
URI.parse(File.join(@options[:url], api_path))
|
39
|
+
end
|
40
|
+
|
37
41
|
def _post_json(payload, uri, headers: {})
|
38
42
|
_check_arg_type(:headers, headers, Hash)
|
39
43
|
_post(payload, uri, headers: headers.merge(HEADER_CONTENT_TYPE => 'application/json'))
|
@@ -61,7 +61,7 @@ module InfluxDB2
|
|
61
61
|
_check('bucket', bucket_param)
|
62
62
|
_check('org', org_param)
|
63
63
|
|
64
|
-
uri =
|
64
|
+
uri = _parse_uri('/api/v2/delete')
|
65
65
|
uri.query = URI.encode_www_form(org: org_param, bucket: bucket_param)
|
66
66
|
|
67
67
|
_post_json(delete_request.to_body.to_json, uri)
|
@@ -32,7 +32,7 @@ module InfluxDB2
|
|
32
32
|
#
|
33
33
|
# @return [HealthCheck]
|
34
34
|
def health
|
35
|
-
uri =
|
35
|
+
uri = _parse_uri('/health')
|
36
36
|
body = _get(uri).body
|
37
37
|
data = JSON.parse("[#{body}]", symbolize_names: true)[0]
|
38
38
|
HealthCheck.new.tap do |model|
|
@@ -70,7 +70,7 @@ module InfluxDB2
|
|
70
70
|
payload = _generate_payload(query, dialect)
|
71
71
|
return nil if payload.nil?
|
72
72
|
|
73
|
-
uri =
|
73
|
+
uri = _parse_uri('/api/v2/query')
|
74
74
|
uri.query = URI.encode_www_form(org: org_param)
|
75
75
|
|
76
76
|
_post_json(payload.to_body.to_json, uri)
|
@@ -160,7 +160,7 @@ module InfluxDB2
|
|
160
160
|
|
161
161
|
return nil unless payload.instance_of?(String) || payload.empty?
|
162
162
|
|
163
|
-
uri =
|
163
|
+
uri = _parse_uri('/api/v2/write')
|
164
164
|
uri.query = URI.encode_www_form(bucket: bucket_param, org: org_param, precision: precision_param.to_s)
|
165
165
|
|
166
166
|
_post_text(payload, uri)
|
@@ -89,4 +89,11 @@ class ClientTest < Minitest::Test
|
|
89
89
|
assert_equal 'influxdb', health.name
|
90
90
|
assert_equal 'fail', health.status
|
91
91
|
end
|
92
|
+
|
93
|
+
def test_trailing_slash_in_url
|
94
|
+
uri = URI.parse(File.join('http://localhost:8099', '/api/v2/write'))
|
95
|
+
assert_equal 'http://localhost:8099/api/v2/write', uri.to_s
|
96
|
+
uri = URI.parse(File.join('http://localhost:8099/', '/api/v2/write'))
|
97
|
+
assert_equal 'http://localhost:8099/api/v2/write', uri.to_s
|
98
|
+
end
|
92
99
|
end
|
@@ -272,4 +272,19 @@ class WriteApiTest < MiniTest::Test
|
|
272
272
|
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
273
273
|
times: 1, body: 'h2o,location=west value=33i 15', headers: headers)
|
274
274
|
end
|
275
|
+
|
276
|
+
def test_trailing_slash_in_url
|
277
|
+
stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
278
|
+
.to_return(status: 204)
|
279
|
+
client = InfluxDB2::Client.new('http://localhost:9999/', 'my-token',
|
280
|
+
bucket: 'my-bucket',
|
281
|
+
org: 'my-org',
|
282
|
+
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
283
|
+
use_ssl: false)
|
284
|
+
|
285
|
+
client.create_write_api.write(data: 'h2o,location=west value=33i 15')
|
286
|
+
|
287
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
288
|
+
times: 1, body: 'h2o,location=west value=33i 15')
|
289
|
+
end
|
275
290
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0.pre.
|
4
|
+
version: 1.4.0.pre.827
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Bednar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|