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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 734edcb4d049de6b3840ee1110dfd3c7cc5a2f2d506fb5f1dc6f650500affb3a
4
- data.tar.gz: 590208d88970bc9cc078ffc4d04df564e64e2744fcbea5b8714658be48722171
3
+ metadata.gz: 3f07f57cbad7ef808ff1fa63def34ff6f06f29c1b2e14b5859f9a55e9ab7398a
4
+ data.tar.gz: f4af2e128dbf11e3465c469a0899c3898c01e81b4970fdfaecb0b3e8e6e2f771
5
5
  SHA512:
6
- metadata.gz: a0a5994cc3bd5e24d1d1c65448f077e3791bd56d53c1bfd5cb6104de6cd02119fd1a9370d4a43110f7ce3f55ba885c80893de2653251129845ae0c1f32a21d0b
7
- data.tar.gz: 5d15203d7148c2b144e6a329849ffdb2191d372a7d633264639c856f84a6614d1c8ca4ac5c3999ff0ff9c653e44564e1fae82e8645c23a88ef273251f7fb03c3
6
+ metadata.gz: 277df5a8efc57fa2a087bf2b4a45b6d2a2e54b7752df1b0ea20e445b0a34ed22690b9a5dff184db11bd7cf9df58b7cd95b0596c13374847963931d9860123de7
7
+ data.tar.gz: 6aab7f0f004344524d988502bbe8819cc959f4d3060ef4779f3bdd11dd9e6aa0b5e9b4c5efcb4faa2cfc94ae1a9c6b3327367ead9b1cecd0081f67fc68000390
@@ -29,7 +29,7 @@ Metrics/LineLength:
29
29
  Metrics/MethodLength:
30
30
  Max: 50
31
31
  Metrics/ClassLength:
32
- Max: 200
32
+ Max: 300
33
33
  Metrics/AbcSize:
34
34
  Max: 40
35
35
  Metrics/CyclomaticComplexity:
@@ -1,5 +1,9 @@
1
1
  ## 1.4.0 [unreleased]
2
2
 
3
+ ### Features
4
+
5
+ 1. [#38](https://github.com/influxdata/influxdb-client-ruby/pull/38): Remove trailing slash from connection URL
6
+
3
7
  ## 1.3.0 [2020-04-17]
4
8
 
5
9
  ### Features
@@ -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 = URI.parse(File.join(@options[:url], '/api/v2/delete'))
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 = URI.parse(File.join(@options[:url], '/health'))
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 = URI.parse(File.join(@options[:url], '/api/v2/query'))
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 = URI.parse(File.join(@options[:url], '/api/v2/write'))
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.771
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-04-17 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler