influxdb-client 1.11.0.pre.1492 → 1.12.0.pre.1894

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: 1236713d44eae0b2c2ae536e01701d2bd18aa5117de56abc9a7b4f66fcbb2be0
4
- data.tar.gz: 167624af36d2c8e14f80b453dd530f7c0a91e6d2e0f454082c401e0ab2086678
3
+ metadata.gz: 348cc579c1aa802928e344e2075f7aa4896363108f9e30407e07c8fe8d293686
4
+ data.tar.gz: 434a5039b83030ce068a3b913880e2c3d084f495cfbd119a839428ceb08f4f5e
5
5
  SHA512:
6
- metadata.gz: bac2f6e4a30be9fc2b98a8ab428e9ff4659f8b1350107cbdf8a73899735353bfba2668c901be2405ae66b8636d314416e56904df7f7cb56399e7c7f052a1b06a
7
- data.tar.gz: 656c0752105f1af52295a94d7b6dc95db691948ecbde468382f991b30498cd9189b25745393fcdddf0a6384944e4c0d0bb4cae7a996deafbd7d1cd90a3510a96
6
+ metadata.gz: f917dc680761aabd57d033211da42712cb560c7461cec2f15f581e40e9f22b6e511c1e8c9874ceaa6f8dc8502c512dc09640f4cdbfdce7e601ba970670ab1788
7
+ data.tar.gz: e5d9bc0d90cf42b3b9b8cd2e10c771f095cbe176adeb022ed903b27e347b028abde77c01bcb59113a419589dcfcce92bb429a4881e82269d5dcf0abedbf7fa2d
data/.circleci/config.yml CHANGED
@@ -78,7 +78,7 @@ jobs:
78
78
  default: &default-ruby-image "circleci/ruby:2.6-stretch"
79
79
  influxdb-image:
80
80
  type: string
81
- default: &default-influxdb-image "influxdb:v2.0.3"
81
+ default: &default-influxdb-image "influxdb:v2.0.4"
82
82
  docker:
83
83
  - image: << parameters.ruby-image >>
84
84
  - image: &influx-image quay.io/influxdb/<< parameters.influxdb-image >>
@@ -117,6 +117,9 @@ workflows:
117
117
  version: 2
118
118
  build:
119
119
  jobs:
120
+ - tests-ruby:
121
+ name: ruby-3.0
122
+ ruby-image: "circleci/ruby:3.0-buster"
120
123
  - tests-ruby:
121
124
  name: ruby-2.7
122
125
  ruby-image: "circleci/ruby:2.7-buster"
@@ -133,6 +136,7 @@ workflows:
133
136
  ruby-image: "circleci/ruby:2.4-stretch"
134
137
  - deploy-preview:
135
138
  requires:
139
+ - ruby-3.0
136
140
  - ruby-2.7
137
141
  - ruby-2.6
138
142
  - ruby-2.6-nightly
data/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
- ## 1.11.0 [unreleased]
1
+ ## 1.12.0 [unreleased]
2
+
3
+ ### Features
4
+ 1. [#71](https://github.com/influxdata/influxdb-client-ruby/pull/71): Added possibility to specify the certification verification behaviour
5
+
6
+ ## 1.11.0 [2021-01-29]
2
7
 
3
8
  ### CI
4
9
  1. [#63](https://github.com/influxdata/influxdb-client-ruby/pull/63): Updated default docker image to v2.0.3
10
+ 1. [#65](https://github.com/influxdata/influxdb-client-ruby/pull/65): Added Ruby 3.0 into CI
5
11
 
6
12
  ## 1.10.0 [2020-12-04]
7
13
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ The client can be installed manually or with bundler.
23
23
  To install the client gem manually:
24
24
 
25
25
  ```
26
- gem install influxdb-client -v 1.10.0
26
+ gem install influxdb-client -v 1.11.0
27
27
  ```
28
28
 
29
29
  ## Usage
@@ -48,6 +48,7 @@ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token')
48
48
  | read_timeout | Number of seconds to wait for one block of data to be read | Integer | 10 |
49
49
  | max_redirect_count | Maximal number of followed HTTP redirects | Integer | 10 |
50
50
  | use_ssl | Turn on/off SSL for HTTP communication | bool | true |
51
+ | verify_mode | Sets the flags for the certification verification at beginning of SSL/TLS session. | `OpenSSL::SSL::VERIFY_NONE` or `OpenSSL::SSL::VERIFY_PEER` | none |
51
52
 
52
53
  ```ruby
53
54
  client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
@@ -27,7 +27,7 @@ DEFAULT_DOCKER_REGISTRY="quay.io/influxdb/"
27
27
  DOCKER_REGISTRY="${DOCKER_REGISTRY:-$DEFAULT_DOCKER_REGISTRY}"
28
28
 
29
29
  DEFAULT_INFLUXDB_V2_REPOSITORY="influxdb"
30
- DEFAULT_INFLUXDB_V2_VERSION="v2.0.3"
30
+ DEFAULT_INFLUXDB_V2_VERSION="v2.0.4"
31
31
  INFLUXDB_V2_REPOSITORY="${INFLUXDB_V2_REPOSITORY:-$DEFAULT_INFLUXDB_V2_REPOSITORY}"
32
32
  INFLUXDB_V2_VERSION="${INFLUXDB_V2_VERSION:-$DEFAULT_INFLUXDB_V2_VERSION}"
33
33
  INFLUXDB_V2_IMAGE=${DOCKER_REGISTRY}${INFLUXDB_V2_REPOSITORY}:${INFLUXDB_V2_VERSION}
@@ -43,6 +43,9 @@ module InfluxDB2
43
43
  # @option options [Integer] :read_timeout Number of seconds to wait for one block of data to be read
44
44
  # @option options [Integer] :max_redirect_count Maximal number of followed HTTP redirects
45
45
  # @option options [bool] :use_ssl Turn on/off SSL for HTTP communication
46
+ # @option options [Integer] :verify_mode Sets the flags for the certification verification
47
+ # at beginning of SSL/TLS session. Could be one of `OpenSSL::SSL::VERIFY_NONE` or `OpenSSL::SSL::VERIFY_PEER`.
48
+ # For more info see - https://docs.ruby-lang.org/en/3.0.0/Net/HTTP.html#verify_mode.
46
49
  # @option options [Logger] :logger Logger used for logging. Disable logging by set to false.
47
50
  # @option options [Hash] :tags Default tags which will be added to each point written by api.
48
51
  # the body line-protocol
@@ -84,11 +84,7 @@ module InfluxDB2
84
84
  def _request(payload, uri, limit: @max_redirect_count, headers: {}, request: Net::HTTP::Post)
85
85
  raise InfluxError.from_message("Too many HTTP redirects. Exceeded limit: #{@max_redirect_count}") if limit.zero?
86
86
 
87
- http = Net::HTTP.new(uri.host, uri.port)
88
- http.open_timeout = @options[:open_timeout] || DEFAULT_TIMEOUT
89
- http.write_timeout = @options[:write_timeout] || DEFAULT_TIMEOUT if Net::HTTP.method_defined? :write_timeout
90
- http.read_timeout = @options[:read_timeout] || DEFAULT_TIMEOUT
91
- http.use_ssl = @options[:use_ssl].nil? ? true : @options[:use_ssl]
87
+ http = _prepare_http_client(uri)
92
88
 
93
89
  request = request.new(uri.request_uri)
94
90
  request['Authorization'] = "Token #{@options[:token]}"
@@ -115,6 +111,16 @@ module InfluxDB2
115
111
  end
116
112
  end
117
113
 
114
+ def _prepare_http_client(uri)
115
+ http = Net::HTTP.new(uri.host, uri.port)
116
+ http.open_timeout = @options[:open_timeout] || DEFAULT_TIMEOUT
117
+ http.write_timeout = @options[:write_timeout] || DEFAULT_TIMEOUT if Net::HTTP.method_defined? :write_timeout
118
+ http.read_timeout = @options[:read_timeout] || DEFAULT_TIMEOUT
119
+ http.use_ssl = @options[:use_ssl].nil? ? true : @options[:use_ssl]
120
+ http.verify_mode = @options[:verify_mode] if @options[:verify_mode]
121
+ http
122
+ end
123
+
118
124
  def _check_arg_type(name, value, klass)
119
125
  raise TypeError, "expected a #{klass.name} for #{name}; got #{value.class.name}" unless value.is_a?(klass)
120
126
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '1.11.0'.freeze
22
+ VERSION = '1.12.0'.freeze
23
23
  end
@@ -57,4 +57,33 @@ class DefaultApiTest < MiniTest::Test
57
57
 
58
58
  @api.log(:info, 'without error')
59
59
  end
60
+
61
+ def test_default_verify_mode
62
+ http_client = @api.send(:_prepare_http_client, URI.parse('https://localhost:8086'))
63
+
64
+ refute_nil http_client
65
+ assert_nil http_client.verify_mode
66
+
67
+ http_client.finish if http_client.started?
68
+ end
69
+
70
+ def test_default_verify_mode_none
71
+ @api = InfluxDB2::DefaultApi.new(options: { logger: @logger, verify_mode: OpenSSL::SSL::VERIFY_NONE })
72
+ http_client = @api.send(:_prepare_http_client, URI.parse('https://localhost:8086'))
73
+
74
+ refute_nil http_client
75
+ assert_equal OpenSSL::SSL::VERIFY_NONE, http_client.verify_mode
76
+
77
+ http_client.finish if http_client.started?
78
+ end
79
+
80
+ def test_default_verify_mode_peer
81
+ @api = InfluxDB2::DefaultApi.new(options: { logger: @logger, verify_mode: OpenSSL::SSL::VERIFY_PEER })
82
+ http_client = @api.send(:_prepare_http_client, URI.parse('https://localhost:8086'))
83
+
84
+ refute_nil http_client
85
+ assert_equal OpenSSL::SSL::VERIFY_PEER, http_client.verify_mode
86
+
87
+ http_client.finish if http_client.started?
88
+ end
60
89
  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.11.0.pre.1492
4
+ version: 1.12.0.pre.1894
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-12-16 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler