influxdb-client 1.2.0.pre.573 → 1.2.0.pre.585

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: 22935436c556b5c953b34b172168a700bba75c6da5eb3cb38ba2f65cc531202f
4
- data.tar.gz: 4ab175926f5b52a647c7c7facba8f2425ec45f1c06a3980a727913d5a8f00d89
3
+ metadata.gz: 45b8cb1432e1dc4ef373fd01beac43ef565ecfdea21a8197e00619c5438bf17d
4
+ data.tar.gz: 12cf7f4b2ae4d055f4dcee263ba3dcaee4f08f9c9180679369320674ed96a1ae
5
5
  SHA512:
6
- metadata.gz: d956a85d7200fb34f0e51def40320a1eeb48ee48c424b877f71a82269fd6052cfe4cdc0c7e8b929d62d7b4c651cc8f50f6bfb49fdc658013cb8ef3ea55e535de
7
- data.tar.gz: 89a1f2b20710d1bae43fd062b0b5ecfd730188e716715b8172ab1491e0f4269be7d2897ccc9e5430fdc51fb0a3da79ca8937efde15689a5bb8f665551af7b351
6
+ metadata.gz: df04b2b5aae151b34be7522e10c225253613bad280c3259895e451d33f3702b640ecf6437efb1526d3c1387ade620a7fbb6cf502bd104f334c6b5367f3861727
7
+ data.tar.gz: af06b2c22b40955b2010235634df46f986b0f8e7f218e5f693d7dc0b44ac5ef016ef51d83342edfafdcd5e98056b99b31122ca26beb3cfb6a18f5f413bbece1a
@@ -3,6 +3,7 @@
3
3
  ### Features
4
4
  1. [#23](https://github.com/influxdata/influxdb-client-ruby/issues/23): Added DeleteApi to delete time series data from InfluxDB.
5
5
  1. [#24](https://github.com/influxdata/influxdb-client-ruby/issues/24): Added jitter_interval and retry_interval to WriteApi
6
+ 1. [#26](https://github.com/influxdata/influxdb-client-ruby/issues/26): Set User-Agent to influxdb-client-ruby/<VERSION> for all requests
6
7
 
7
8
  ### Bugs
8
9
  1. [#22](https://github.com/influxdata/influxdb-client-ruby/pull/22): Fixed batch write
@@ -43,6 +43,7 @@ module InfluxDB2
43
43
 
44
44
  request = Net::HTTP::Post.new(uri.request_uri)
45
45
  request['Authorization'] = "Token #{@options[:token]}"
46
+ request['User-Agent'] = "influxdb-client-ruby/#{InfluxDB2::VERSION}"
46
47
  request.body = payload
47
48
 
48
49
  begin
@@ -96,4 +96,25 @@ class DeleteApiTest < MiniTest::Test
96
96
 
97
97
  assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
98
98
  end
99
+
100
+ def test_user_agent_header
101
+ stub_request(:any, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org')
102
+ .to_return(status: 204)
103
+ client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
104
+ bucket: 'my-bucket',
105
+ org: 'my-org',
106
+ precision: InfluxDB2::WritePrecision::NANOSECOND,
107
+ use_ssl: false)
108
+
109
+ client.create_delete_api.delete('2019-02-03T04:05:06+07:00', '2019-04-03T04:05:06+07:00',
110
+ bucket: 'my-bucket', org: 'my-org')
111
+
112
+ body = '{"start":"2019-02-03T04:05:06+07:00","stop":"2019-04-03T04:05:06+07:00"}'
113
+ headers = {
114
+ 'Authorization' => 'Token my-token',
115
+ 'User-Agent' => "influxdb-client-ruby/#{InfluxDB2::VERSION}"
116
+ }
117
+ assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org',
118
+ times: 1, body: body, headers: headers)
119
+ end
99
120
  end
@@ -72,4 +72,24 @@ class QueryApiTest < MiniTest::Test
72
72
  assert_equal 10, record1.value
73
73
  assert_equal 'free', record1.field
74
74
  end
75
+
76
+ def test_user_agent_header
77
+ stub_request(:post, 'http://localhost:9999/api/v2/query?org=my-org')
78
+ .to_return(body: SUCCESS_DATA)
79
+
80
+ client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
81
+ bucket: 'my-bucket',
82
+ org: 'my-org',
83
+ use_ssl: false)
84
+
85
+ client.create_query_api
86
+ .query(query: 'from(bucket:"my-bucket") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()')
87
+
88
+ headers = {
89
+ 'Authorization' => 'Token my-token',
90
+ 'User-Agent' => "influxdb-client-ruby/#{InfluxDB2::VERSION}"
91
+ }
92
+ assert_requested(:post, 'http://localhost:9999/api/v2/query?org=my-org',
93
+ times: 1, headers: headers)
94
+ end
75
95
  end
@@ -251,4 +251,24 @@ class WriteApiTest < MiniTest::Test
251
251
 
252
252
  assert_equal 'The time precision not_supported is not supported.', error.message
253
253
  end
254
+
255
+ def test_user_agent_header
256
+ stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
257
+ .to_return(status: 204)
258
+
259
+ client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
260
+ bucket: 'my-bucket',
261
+ org: 'my-org',
262
+ precision: InfluxDB2::WritePrecision::NANOSECOND,
263
+ use_ssl: false)
264
+
265
+ client.create_write_api.write(data: 'h2o,location=west value=33i 15')
266
+
267
+ headers = {
268
+ 'Authorization' => 'Token my-token',
269
+ 'User-Agent' => "influxdb-client-ruby/#{InfluxDB2::VERSION}"
270
+ }
271
+ assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
272
+ times: 1, body: 'h2o,location=west value=33i 15', headers: headers)
273
+ end
254
274
  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.2.0.pre.573
4
+ version: 1.2.0.pre.585
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-02-26 00:00:00.000000000 Z
11
+ date: 2020-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler