influxdb-client 1.0.0.beta → 1.0.0.pre.3

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.
@@ -26,7 +26,7 @@ class WriteApiTest < MiniTest::Test
26
26
  end
27
27
 
28
28
  def test_required_arguments
29
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token')
29
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token')
30
30
  write_api = client.create_write_api
31
31
 
32
32
  # precision
@@ -35,19 +35,19 @@ class WriteApiTest < MiniTest::Test
35
35
  end
36
36
  # bucket
37
37
  assert_raises ArgumentError do
38
- write_api.write(data: {}, org: 'my-org', precision: InfluxDB2::WritePrecision::NANOSECOND)
38
+ write_api.write(data: {}, org: 'my-org', precision: InfluxDB::WritePrecision::NANOSECOND)
39
39
  end
40
40
  # org
41
41
  assert_raises ArgumentError do
42
- write_api.write(data: {}, bucket: 'my-bucket', precision: InfluxDB2::WritePrecision::NANOSECOND)
42
+ write_api.write(data: {}, bucket: 'my-bucket', precision: InfluxDB::WritePrecision::NANOSECOND)
43
43
  end
44
44
  end
45
45
 
46
46
  def test_default_arguments_
47
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
48
- bucket: 'my-bucket',
49
- org: 'my-org',
50
- precision: InfluxDB2::WritePrecision::NANOSECOND)
47
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
48
+ bucket: 'my-bucket',
49
+ org: 'my-org',
50
+ precision: InfluxDB::WritePrecision::NANOSECOND)
51
51
  write_api = client.create_write_api
52
52
 
53
53
  # without argument errors
@@ -57,11 +57,10 @@ class WriteApiTest < MiniTest::Test
57
57
  def test_write_line_protocol
58
58
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
59
59
  .to_return(status: 204)
60
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
61
- bucket: 'my-bucket',
62
- org: 'my-org',
63
- precision: InfluxDB2::WritePrecision::NANOSECOND,
64
- use_ssl: false)
60
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
61
+ bucket: 'my-bucket',
62
+ org: 'my-org',
63
+ precision: InfluxDB::WritePrecision::NANOSECOND)
65
64
 
66
65
  client.create_write_api.write(data: 'h2o,location=west value=33i 15')
67
66
 
@@ -72,13 +71,12 @@ class WriteApiTest < MiniTest::Test
72
71
  def test_write_point
73
72
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
74
73
  .to_return(status: 204)
75
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
76
- bucket: 'my-bucket',
77
- org: 'my-org',
78
- precision: InfluxDB2::WritePrecision::NANOSECOND,
79
- use_ssl: false)
74
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
75
+ bucket: 'my-bucket',
76
+ org: 'my-org',
77
+ precision: InfluxDB::WritePrecision::NANOSECOND)
80
78
 
81
- client.create_write_api.write(data: InfluxDB2::Point.new(name: 'h2o')
79
+ client.create_write_api.write(data: InfluxDB::Point.new(name: 'h2o')
82
80
  .add_tag('location', 'europe')
83
81
  .add_field('level', 2))
84
82
 
@@ -89,11 +87,10 @@ class WriteApiTest < MiniTest::Test
89
87
  def test_write_hash
90
88
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
91
89
  .to_return(status: 204)
92
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
93
- bucket: 'my-bucket',
94
- org: 'my-org',
95
- precision: InfluxDB2::WritePrecision::NANOSECOND,
96
- use_ssl: false)
90
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
91
+ bucket: 'my-bucket',
92
+ org: 'my-org',
93
+ precision: InfluxDB::WritePrecision::NANOSECOND)
97
94
 
98
95
  client.create_write_api.write(data: { name: 'h2o',
99
96
  tags: { host: 'aws', region: 'us' },
@@ -107,15 +104,14 @@ class WriteApiTest < MiniTest::Test
107
104
  def test_write_collection
108
105
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
109
106
  .to_return(status: 204)
110
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
111
- bucket: 'my-bucket',
112
- org: 'my-org',
113
- precision: InfluxDB2::WritePrecision::NANOSECOND,
114
- use_ssl: false)
107
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
108
+ bucket: 'my-bucket',
109
+ org: 'my-org',
110
+ precision: InfluxDB::WritePrecision::NANOSECOND)
115
111
 
116
- point = InfluxDB2::Point.new(name: 'h2o')
117
- .add_tag('location', 'europe')
118
- .add_field('level', 2)
112
+ point = InfluxDB::Point.new(name: 'h2o')
113
+ .add_tag('location', 'europe')
114
+ .add_field('level', 2)
119
115
 
120
116
  hash = { name: 'h2o',
121
117
  tags: { host: 'aws', region: 'us' },
@@ -123,8 +119,8 @@ class WriteApiTest < MiniTest::Test
123
119
 
124
120
  client.create_write_api.write(data: ['h2o,location=west value=33i 15', nil, '', point, hash])
125
121
 
126
- expected = "h2o,location=west value=33i 15\nh2o,location=europe level=2i"\
127
- "\nh2o,host=aws,region=us level=5i,saturation=\"99%\" 123"
122
+ expected = 'h2o,location=west value=33i 15\nh2o,location=europe level=2i'\
123
+ '\nh2o,host=aws,region=us level=5i,saturation="99%" 123'
128
124
  assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
129
125
  times: 1, body: expected)
130
126
  end
@@ -132,11 +128,10 @@ class WriteApiTest < MiniTest::Test
132
128
  def test_authorization_header
133
129
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
134
130
  .to_return(status: 204)
135
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
136
- bucket: 'my-bucket',
137
- org: 'my-org',
138
- precision: InfluxDB2::WritePrecision::NANOSECOND,
139
- use_ssl: false)
131
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
132
+ bucket: 'my-bucket',
133
+ org: 'my-org',
134
+ precision: InfluxDB::WritePrecision::NANOSECOND)
140
135
 
141
136
  client.create_write_api.write(data: 'h2o,location=west value=33i 15')
142
137
 
@@ -147,10 +142,10 @@ class WriteApiTest < MiniTest::Test
147
142
  def test_without_data
148
143
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
149
144
  .to_return(status: 204)
150
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
151
- bucket: 'my-bucket',
152
- org: 'my-org',
153
- precision: InfluxDB2::WritePrecision::NANOSECOND)
145
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
146
+ bucket: 'my-bucket',
147
+ org: 'my-org',
148
+ precision: InfluxDB::WritePrecision::NANOSECOND)
154
149
 
155
150
  client.create_write_api.write(data: '')
156
151
 
@@ -164,13 +159,12 @@ class WriteApiTest < MiniTest::Test
164
159
  stub_request(:any, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
165
160
  .to_return(status: 400, headers: { 'X-Platform-Error-Code' => 'invalid' }, body: error_body)
166
161
 
167
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
168
- bucket: 'my-bucket',
169
- org: 'my-org',
170
- precision: InfluxDB2::WritePrecision::NANOSECOND,
171
- use_ssl: false)
162
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
163
+ bucket: 'my-bucket',
164
+ org: 'my-org',
165
+ precision: InfluxDB::WritePrecision::NANOSECOND)
172
166
 
173
- error = assert_raises InfluxDB2::InfluxError do
167
+ error = assert_raises InfluxDB::InfluxError do
174
168
  client.create_write_api.write(data: 'h2o,location=west value=33i 15')
175
169
  end
176
170
 
@@ -187,11 +181,10 @@ class WriteApiTest < MiniTest::Test
187
181
  stub_request(:any, 'http://localhost:9090/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
188
182
  .to_return(status: 204)
189
183
 
190
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
191
- bucket: 'my-bucket',
192
- org: 'my-org',
193
- precision: InfluxDB2::WritePrecision::NANOSECOND,
194
- use_ssl: false)
184
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
185
+ bucket: 'my-bucket',
186
+ org: 'my-org',
187
+ precision: InfluxDB::WritePrecision::NANOSECOND)
195
188
 
196
189
  client.create_write_api.write(data: 'h2o,location=west value=33i 15')
197
190
 
@@ -206,30 +199,16 @@ class WriteApiTest < MiniTest::Test
206
199
  .to_return(status: 307, headers:
207
200
  { 'location' => 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns' })
208
201
 
209
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
210
- bucket: 'my-bucket',
211
- org: 'my-org',
212
- precision: InfluxDB2::WritePrecision::NANOSECOND,
213
- max_redirect_count: 5,
214
- use_ssl: false)
202
+ client = InfluxDB::Client.new('http://localhost:9999', 'my-token',
203
+ bucket: 'my-bucket',
204
+ org: 'my-org',
205
+ precision: InfluxDB::WritePrecision::NANOSECOND,
206
+ max_redirect_count: 5)
215
207
 
216
- error = assert_raises InfluxDB2::InfluxError do
208
+ error = assert_raises InfluxDB::InfluxError do
217
209
  client.create_write_api.write(data: 'h2o,location=west value=33i 15')
218
210
  end
219
211
 
220
212
  assert_equal 'Too many HTTP redirects. Exceeded limit: 5', error.message
221
213
  end
222
-
223
- def test_write_precision_constant
224
- assert_equal InfluxDB2::WritePrecision::SECOND, InfluxDB2::WritePrecision.new.get_from_value('s')
225
- assert_equal InfluxDB2::WritePrecision::MILLISECOND, InfluxDB2::WritePrecision.new.get_from_value('ms')
226
- assert_equal InfluxDB2::WritePrecision::MICROSECOND, InfluxDB2::WritePrecision.new.get_from_value('us')
227
- assert_equal InfluxDB2::WritePrecision::NANOSECOND, InfluxDB2::WritePrecision.new.get_from_value('ns')
228
-
229
- error = assert_raises RuntimeError do
230
- InfluxDB2::WritePrecision.new.get_from_value('not_supported')
231
- end
232
-
233
- assert_equal 'The time precision not_supported is not supported.', error.message
234
- end
235
214
  end
@@ -27,7 +27,7 @@ if ENV['CI'] == 'true'
27
27
  end
28
28
 
29
29
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
30
- require 'influxdb2/client'
30
+ require 'influxdb/client'
31
31
 
32
32
  require 'minitest/autorun'
33
33
  require 'minitest/reporters'
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.0.0.beta
4
+ version: 1.0.0.pre.3
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-01-17 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,36 +130,33 @@ extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
132
  - ".circleci/config.yml"
133
- - ".circleci/setup-rubygems.sh"
134
133
  - ".github/PULL_REQUEST_TEMPLATE"
135
134
  - ".gitignore"
136
135
  - ".rubocop.yml"
137
- - CHANGELOG.md
138
136
  - Gemfile
139
- - LICENSE
137
+ - LICENSE.txt
140
138
  - README.md
141
139
  - Rakefile
142
- - bin/influxdb-onboarding.sh
143
140
  - bin/influxdb-restart.sh
144
141
  - influxdb-client.gemspec
145
- - lib/influxdb2/client.rb
146
- - lib/influxdb2/client/client.rb
147
- - lib/influxdb2/client/influx_error.rb
148
- - lib/influxdb2/client/point.rb
149
- - lib/influxdb2/client/version.rb
150
- - lib/influxdb2/client/write_api.rb
142
+ - lib/influxdb/client.rb
143
+ - lib/influxdb/client/client.rb
144
+ - lib/influxdb/client/influx_error.rb
145
+ - lib/influxdb/client/point.rb
146
+ - lib/influxdb/client/version.rb
147
+ - lib/influxdb/client/write_api.rb
151
148
  - test/influxdb/client_test.rb
152
149
  - test/influxdb/point_test.rb
153
150
  - test/influxdb/write_api_integration_test.rb
154
151
  - test/influxdb/write_api_test.rb
155
152
  - test/test_helper.rb
156
- homepage: https://github.com/influxdata/influxdb-client-ruby
153
+ homepage: https://github.com/bonitoo-io/influxdb-client-ruby
157
154
  licenses:
158
155
  - MIT
159
156
  metadata:
160
- homepage_uri: https://github.com/influxdata/influxdb-client-ruby
161
- source_code_uri: https://github.com/influxdata/influxdb-client-ruby
162
- changelog_uri: https://raw.githubusercontent.com/influxdata/influxdb-client-ruby/master/CHANGELOG.md
157
+ homepage_uri: https://github.com/bonitoo-io/influxdb-client-ruby
158
+ source_code_uri: https://github.com/bonitoo-io/influxdb-client-ruby
159
+ changelog_uri: https://raw.githubusercontent.com/bonitoo-io/influxdb-client-ruby/master/CHANGELOG.md
163
160
  post_install_message:
164
161
  rdoc_options: []
165
162
  require_paths:
@@ -168,14 +165,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
165
  requirements:
169
166
  - - ">="
170
167
  - !ruby/object:Gem::Version
171
- version: 2.2.0
168
+ version: '0'
172
169
  required_rubygems_version: !ruby/object:Gem::Requirement
173
170
  requirements:
174
171
  - - ">"
175
172
  - !ruby/object:Gem::Version
176
173
  version: 1.3.1
177
174
  requirements: []
178
- rubygems_version: 3.0.3
175
+ rubygems_version: 3.0.6
179
176
  signing_key:
180
177
  specification_version: 4
181
178
  summary: Ruby library for InfluxDB 2.
@@ -1,3 +0,0 @@
1
- mkdir ~/.gem || true
2
- echo -e "---\r\n:rubygems_api_key: $GEM_HOST_API_KEY" > ~/.gem/credentials
3
- chmod 0600 ~/.gem/credentials
@@ -1,5 +0,0 @@
1
- ## 1.0.0.beta [2020-01-17]
2
-
3
- ### Features
4
- 1. [#4](https://github.com/influxdata/influxdb-client-ruby/pull/4): Added WriteApi that will be used for Fluentd plugin
5
-
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # The MIT License
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
- #
23
-
24
- set -e
25
-
26
- echo "Wait to start InfluxDB 2.0"
27
- wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics
28
-
29
- echo
30
- echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
31
- echo
32
- curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
33
- -d '{
34
- "username": "my-user",
35
- "password": "my-password",
36
- "org": "my-org",
37
- "bucket": "my-bucket",
38
- "token": "my-token"
39
- }'