influxparser 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: f52776eebd46f588f036de0d523f3a8877c122e1
4
- data.tar.gz: 9a798c8a95952675cb11961e52cd91a3e6b03d12
3
+ metadata.gz: 79b8236a2441da883a688e7d4284a1c191358db2
4
+ data.tar.gz: b2d6bc730f78faad33e35429c5e68e9c19c292ed
5
5
  SHA512:
6
- metadata.gz: bf6ec6f5b0376b4f2902d7c11b749b9d0ff9b62f3bb4d66a0b6d54164ee48a15a6cb7b78097604a9626e4226a310c77bea445a60b86770436e35900a6ac99484
7
- data.tar.gz: d78c4e1005e41546958888b29a12b9bc004672b87edf03715d11ac88b9a670806dac093327fecf5f4d858aba3db926858f3c777f315a21cd1808aa2ffc54974e
6
+ metadata.gz: db897eaf4b325a0ed1c0bffde1162ed1e23d6ff1800c6762b90749117af45a782e33795cd117a9a44e74754af7725980c5d8fc384537216178c0c74bfb061596
7
+ data.tar.gz: 83a972e25f5e5259230c2bb9cb6e3a46b3faadb46694d4a11e76a25deb3b5cb3eff27e06ef0be1f3da0664653f96950bbc6c5b43b338cbacaf7cbd3fa9eda982
@@ -15,7 +15,7 @@ class InfluxParser
15
15
 
16
16
 
17
17
  mparts = s[0..measurement_end-1].split(/(?<!\\),/) # split on unescaped commas for the measurement name and tags
18
- point['measurement'] = unescape_measurement mparts[0]
18
+ point['series'] = unescape_measurement mparts[0]
19
19
 
20
20
  # if any tags were attached to the measurement iterate over them now
21
21
  point['tags'] = {}
@@ -46,19 +46,19 @@ class InfluxParser
46
46
  if has_space
47
47
  time_stamp = last_value_raw[has_space+1..-1] # take everything from the space to the end
48
48
  if time_stamp.index(/"/)
49
- point['time'] = nil
49
+ point['timestamp'] = nil
50
50
  else
51
51
  # it was a timestamp, strip it from the last value and set the timestamp
52
52
  point['values'][last_key] = unescape_point(last_value_raw[0..has_space-1],options)
53
- point['time'] = time_stamp
53
+ point['timestamp'] = time_stamp
54
54
  if options[:time_format]
55
55
  n_time = time_stamp.to_f / 1000000000
56
56
  t = Time.at(n_time).utc
57
- point['time'] = t.strftime(options[:time_format])
57
+ point['timestamp'] = t.strftime(options[:time_format])
58
58
  end
59
59
  end
60
60
  else
61
- point['time'] = nil
61
+ point['timestamp'] = nil
62
62
  end
63
63
 
64
64
  point
@@ -15,7 +15,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
15
15
  assert_not_equal(false,point) # a straight up parse error will false
16
16
 
17
17
  # measurement
18
- assert_equal('weather',point['measurement'])
18
+ assert_equal('weather',point['series'])
19
19
 
20
20
  # tags
21
21
  assert_equal(2,point['tags'].length)
@@ -33,7 +33,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
33
33
  assert_equal(82,point['values']['temperature'])
34
34
 
35
35
  # time
36
- assert_equal('1465839830100400200',point['time'])
36
+ assert_equal('1465839830100400200',point['timestamp'])
37
37
 
38
38
  end
39
39
 
@@ -42,7 +42,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
42
42
  assert_not_equal(false,point) # a straight up parse error will false
43
43
 
44
44
  # measurement
45
- assert_equal('weather',point['measurement'])
45
+ assert_equal('weather',point['series'])
46
46
 
47
47
  # no tags
48
48
  assert_equal(true,point.key?('tags'))
@@ -53,7 +53,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
53
53
  assert_equal(82,point['values']['temperature'])
54
54
 
55
55
  # time
56
- assert_equal('1465839830100400200',point['time'])
56
+ assert_equal('1465839830100400200',point['timestamp'])
57
57
 
58
58
  end
59
59
 
@@ -62,7 +62,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
62
62
  assert_not_equal(false,point) # a straight up parse error will false
63
63
 
64
64
  # measurement
65
- assert_equal('weather',point['measurement'])
65
+ assert_equal('weather',point['series'])
66
66
 
67
67
  # check location
68
68
  assert_equal(true,point['tags'].key?('location'))
@@ -78,24 +78,24 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
78
78
  assert_equal(71,point['values']['humidity'])
79
79
 
80
80
  # time
81
- assert_equal('1465839830100400200',point['time'])
81
+ assert_equal('1465839830100400200',point['timestamp'])
82
82
 
83
83
  end
84
84
  def test_timestamp
85
85
  # no timestamp
86
86
  point = InfluxParser.parse_point('weather,location=us-midwest temperature=82')
87
87
  assert_not_equal(false,point) # a straight up parse error will false
88
- assert_nil(point['time'])
88
+ assert_nil(point['timestamp'])
89
89
 
90
90
  # unformatted time
91
91
  point = InfluxParser.parse_point('weather,location=us-midwest temperature=82 1465839830100400200')
92
92
  assert_not_equal(false,point) # a straight up parse error will false
93
- assert_equal('1465839830100400200',point['time'])
93
+ assert_equal('1465839830100400200',point['timestamp'])
94
94
 
95
95
  # time
96
96
  point = InfluxParser.parse_point('weather,location=us-midwest temperature=82 1465839830100400200',{:time_format => "%Y-%d-%mT%H:%M:%S.%NZ"})
97
97
  assert_not_equal(false,point) # a straight up parse error will false
98
- assert_equal('2016-13-06T17:43:50.100400209Z',point['time'])
98
+ assert_equal('2016-13-06T17:43:50.100400209Z',point['timestamp'])
99
99
 
100
100
  end
101
101
 
@@ -177,7 +177,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
177
177
 
178
178
  assert_not_equal(false,point) # a straight up parse error will false
179
179
  # measurement
180
- assert_equal('"weather"',point['measurement'])
180
+ assert_equal('"weather"',point['series'])
181
181
 
182
182
  # check tag
183
183
  assert_equal(true,point['tags'].key?('"location"'))
@@ -189,7 +189,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
189
189
  assert_equal(82,point['values']['"temperature"'])
190
190
 
191
191
  # time
192
- assert_equal('1465839830100400200',point['time'])
192
+ assert_equal('1465839830100400200',point['timestamp'])
193
193
 
194
194
 
195
195
 
@@ -198,7 +198,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
198
198
 
199
199
  assert_not_equal(false,point) # a straight up parse error will false
200
200
  # measurement
201
- assert_equal("'weather'",point['measurement'])
201
+ assert_equal("'weather'",point['series'])
202
202
 
203
203
  # check tag
204
204
  assert_equal(true,point['tags'].key?("'location'"))
@@ -210,7 +210,7 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
210
210
  assert_equal(82,point['values']["'temperature'"])
211
211
 
212
212
  # time
213
- assert_equal('1465839830100400200',point['time'])
213
+ assert_equal('1465839830100400200',point['timestamp'])
214
214
 
215
215
  end
216
216
 
@@ -229,11 +229,11 @@ class TestParsePointFromDocs < Test::Unit::TestCase # def setup
229
229
 
230
230
  point = InfluxParser.parse_point('wea\,ther,location=us-midwest temperature=82 1465839830100400200')
231
231
  assert_not_equal(false,point) # a straight up parse error will false
232
- assert_equal('wea,ther',point['measurement'])
232
+ assert_equal('wea,ther',point['series'])
233
233
 
234
234
  point = InfluxParser.parse_point('wea\ ther,location=us-midwest temperature=82 1465839830100400200')
235
235
  assert_not_equal(false,point) # a straight up parse error will false
236
- assert_equal('wea ther',point['measurement'])
236
+ assert_equal('wea ther',point['series'])
237
237
 
238
238
  point = InfluxParser.parse_point('weather temperature=toohot\"')
239
239
  assert_not_equal(false,point) # a straight up parse error will false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Labrie