influxdb-client 2.10.0.pre.6588 → 3.0.0.pre.7554

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: 2a7381ec21eaf19a8d1cca627adb30a9a08e1c804dae54aefc8b7aa462b0b4a4
4
- data.tar.gz: 6981419ee5644610c017a747e4410a9bdc22fe5eb45a16471f159e31229d70f6
3
+ metadata.gz: e4b2dc7e810dddec2388e1f1241287aab923d6605209fed449614c1bda7318af
4
+ data.tar.gz: d9c941fa890969401a179d439607a1b7434ed128ed6ce5916abb395944e674d9
5
5
  SHA512:
6
- metadata.gz: 5126b0f171f1865d78f2a7ab349d0e5016c76c268961c7a2df34e22ab0353b987c3b07388946556d0880ee617b4c4123a71a29695e1206057f0037bcbc77127f
7
- data.tar.gz: b0467641ca44acce6a5b7b82c48ce790564d8e3a7398fe831e2424a18b25aeeea2d7f219ffdc796cc0e9ea9b8b3c4bfcdd888d7db8621bd25be90e1fa9cc9c76
6
+ metadata.gz: a043003e7a44b38dbf5cc6524ad82069b05e9b25b84ae86ec1b37ce7eb1ee6411798345206e4a8d3821ca5111288111b99557b7a4e94a49dc97cbe870d3c6f16
7
+ data.tar.gz: 81193329f1814dc989b05f6f0f5be3808b11d881b9c64ca73e540237df4f0947cdb9001722d3687352fb41d60d7c55d68e64cde581e92bfa05caa232ea9640ce
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
- ## 2.10.0 [unreleased]
1
+ ## 3.0.0 [unreleased]
2
2
 
3
- ## 2.9.0 [2022-01-12]
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
5
+
6
+ ## 2.9.0 [2022-12-01]
4
7
 
5
8
  :warning: The client can be used as a resource:
6
9
 
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
45
45
  spec.required_ruby_version = '>= 2.2.0'
46
46
 
47
47
  spec.add_development_dependency 'bundler', '~> 2.0'
48
- spec.add_development_dependency 'minitest', '~> 5.0'
48
+ spec.add_development_dependency 'minitest', '5.15.0'
49
49
  spec.add_development_dependency 'minitest-reporters', '~> 1.4'
50
50
  spec.add_development_dependency 'rake', '~> 13.0'
51
51
  spec.add_development_dependency 'rubocop', '~> 0.66.0'
@@ -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.6588
4
+ version: 3.0.0.pre.7554
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: 5.15.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: 5.15.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest-reporters
43
43
  requirement: !ruby/object:Gem::Requirement