influxdb-client 2.10.0.pre.7445 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5078b8c7c980f7a6462ed86670292359d3cf55f5ccfe9997cbf7030ff8fe697
4
- data.tar.gz: 2bd59a68d4a87482fac43c57c1b1c5f0f138f7cab02177e8cbb819f21d164e05
3
+ metadata.gz: 7df039eb876d1f1838a22630b2477fd4f07911b633d52e42012153dca539c0ca
4
+ data.tar.gz: dd1713ccdd4b0ab34ab71d4b0159a83ef9534c1ed5bed3af2949a11c04a75f36
5
5
  SHA512:
6
- metadata.gz: 1858b8882d2f96a12f1c20e1df59b2bdac9d2fff62629c0edc6b5c676b45864a4a677cde7aa70fd6829b42158e900aa795aba78725f468fa26b7dd4284aca472
7
- data.tar.gz: a4683d000749b97477f0584e23352f18a3efb703265beebe931b4f12aff4ef3ad89e7330b919ad02780b676f832de756c96d959f3070834376ca579876240847
6
+ metadata.gz: c85780d8b6a499f2d9eb7f312351916bd0bf4b6b02fb64fd1f31ca9e0135068057ef304c02e975f4752d2ddb285b19c95538bcb9e77d25c103d917aa05a154d7
7
+ data.tar.gz: 54b181dd450e2ba225a916cdb59727423d011c4793eb0cba0d2d95e1c2323a95b0518535e5eb9f39491e6e30fa2d837c21bb20220d3ae213b5f9a1435853d602
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## 2.10.0 [unreleased]
1
+ ## 3.0.0 [2023-12-05]
2
+
3
+ ### Bug Fixes
4
+ 1. [#131](https://github.com/influxdata/influxdb-client-ruby/pull/131): Convert time objects present in fields to integer. Prior to this change the timestamps were converted to strings
2
5
 
3
6
  ## 2.9.0 [2022-12-01]
4
7
 
data/README.md CHANGED
@@ -64,13 +64,13 @@ The client can be installed manually or with bundler.
64
64
  To install the client gem manually:
65
65
 
66
66
  ```
67
- gem install influxdb-client -v 2.9.0
67
+ gem install influxdb-client -v 3.0.0
68
68
  ```
69
69
 
70
70
  For management API:
71
71
 
72
72
  ```
73
- gem install influxdb-client-apis -v 2.9.0
73
+ gem install influxdb-client-apis -v 3.0.0
74
74
  ```
75
75
 
76
76
  ## Usage
@@ -127,7 +127,7 @@ module InfluxDB2
127
127
  return nil if fields.empty?
128
128
 
129
129
  line_protocol << " #{fields}" if fields
130
- timestamp = _escape_time
130
+ timestamp = _escape_time(@time)
131
131
  line_protocol << " #{timestamp}" if timestamp
132
132
 
133
133
  line_protocol
@@ -185,6 +185,8 @@ module InfluxDB2
185
185
  '"'.freeze + result + '"'.freeze
186
186
  elsif value.is_a?(Integer)
187
187
  "#{value}i"
188
+ elsif value.is_a?(Time)
189
+ "#{_escape_time(value)}i"
188
190
  elsif [Float::INFINITY, -Float::INFINITY].include?(value)
189
191
  ''
190
192
  else
@@ -192,16 +194,16 @@ module InfluxDB2
192
194
  end
193
195
  end
194
196
 
195
- def _escape_time
196
- if @time.nil?
197
+ def _escape_time(value)
198
+ if value.nil?
197
199
  nil
198
- elsif @time.is_a?(Integer)
199
- @time.to_s
200
- elsif @time.is_a?(Float)
201
- @time.round.to_s
202
- elsif @time.is_a?(Time)
203
- nano_seconds = @time.to_i * 1e9
204
- nano_seconds += @time.tv_nsec
200
+ elsif value.is_a?(Integer)
201
+ value.to_s
202
+ elsif value.is_a?(Float)
203
+ value.round.to_s
204
+ elsif value.is_a?(Time)
205
+ nano_seconds = value.to_i * 1e9
206
+ nano_seconds += value.tv_nsec
205
207
  case @precision || DEFAULT_WRITE_PRECISION
206
208
  when InfluxDB2::WritePrecision::MILLISECOND then
207
209
  (nano_seconds / 1e6).round
@@ -213,7 +215,7 @@ module InfluxDB2
213
215
  nano_seconds.round
214
216
  end
215
217
  else
216
- @time.to_s
218
+ value.to_s
217
219
  end
218
220
  end
219
221
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '2.10.0'.freeze
22
+ VERSION = '3.0.0'.freeze
23
23
  end
@@ -64,6 +64,7 @@ class PointTest < MiniTest::Test
64
64
  end
65
65
 
66
66
  def test_field_types
67
+ time = Time.utc(2023, 11, 1)
67
68
  point = InfluxDB2::Point.new(name: 'h2o')
68
69
  .add_tag('tag_b', 'b')
69
70
  .add_tag('tag_a', 'a')
@@ -73,8 +74,10 @@ class PointTest < MiniTest::Test
73
74
  .add_field('n4', 5.5)
74
75
  .add_field('bool', true)
75
76
  .add_field('string', 'string value')
77
+ .add_field('started', time)
76
78
 
77
- expected = 'h2o,tag_a=a,tag_b=b bool=true,n1=-2i,n2=10i,n3=1265437718438866624512i,n4=5.5,string="string value"'
79
+ expected = 'h2o,tag_a=a,tag_b=b bool=true,n1=-2i,n2=10i,n3=1265437718438866624512i,n4=5.5,'\
80
+ 'started=1698796800000000000i,string="string value"'
78
81
  assert_equal expected, point.to_line_protocol
79
82
  end
80
83
 
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: 2.10.0.pre.7445
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-14 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -180,27 +180,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
180
  version: 2.2.0
181
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  requirements:
183
- - - ">"
183
+ - - ">="
184
184
  - !ruby/object:Gem::Version
185
- version: 1.3.1
185
+ version: '0'
186
186
  requirements: []
187
- rubygems_version: 3.3.11
187
+ rubygems_version: 3.0.3.1
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Ruby library for InfluxDB 2.
191
191
  test_files:
192
- - test/influxdb/client_test.rb
192
+ - test/influxdb/query_api_integration_test.rb
193
193
  - test/influxdb/default_api_test.rb
194
+ - test/influxdb/client_test.rb
195
+ - test/influxdb/query_api_test.rb
194
196
  - test/influxdb/delete_api_integration_test.rb
195
- - test/influxdb/delete_api_test.rb
196
- - test/influxdb/flux_csv_parser_test.rb
197
- - test/influxdb/invokable_scripts_api_test.rb
198
- - test/influxdb/point_test.rb
199
- - test/influxdb/query_api_integration_test.rb
197
+ - test/influxdb/write_api_integration_test.rb
200
198
  - test/influxdb/query_api_stream_test.rb
201
- - test/influxdb/query_api_test.rb
199
+ - test/influxdb/flux_csv_parser_test.rb
200
+ - test/influxdb/delete_api_test.rb
202
201
  - test/influxdb/redirect_test.rb
203
- - test/influxdb/write_api_batching_test.rb
204
- - test/influxdb/write_api_integration_test.rb
205
202
  - test/influxdb/write_api_test.rb
203
+ - test/influxdb/write_api_batching_test.rb
204
+ - test/influxdb/point_test.rb
205
+ - test/influxdb/invokable_scripts_api_test.rb
206
206
  - test/test_helper.rb