diff --git a/.rubocop.yml b/.rubocop.yml index 6a7a010..d181792 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -53,3 +53,9 @@ Style/RaiseArgs: Style/SymbolArray: EnforcedStyle: brackets + +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: 'comma' + +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: 'comma' diff --git a/Gemfile.lock b/Gemfile.lock index c5caa5c..96d447f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,13 +8,23 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.5.2) + addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) ast (2.4.0) - coderay (1.1.1) + coderay (1.1.2) + coveralls (0.8.23) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (>= 0.19.4, < 2.0) + tins (~> 1.6) + crack (0.4.3) + safe_yaml (~> 1.0.0) diff-lcs (1.3) + docile (1.3.1) domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) + hashdiff (0.3.9) http (2.2.2) addressable (~> 2.3) http-cookie (~> 1.0) @@ -25,17 +35,15 @@ GEM http-form_data (1.0.3) http_parser.rb (0.6.0) jaro_winkler (1.5.2) - json (2.1.0) - method_source (0.8.2) - parallel (1.12.1) - parser (2.5.3.0) + json (2.2.0) + method_source (0.9.2) + parallel (1.17.0) + parser (2.6.3.0) ast (~> 2.4.0) - powerpack (0.1.2) - pry (0.10.4) + pry (0.12.2) coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (3.0.3) + method_source (~> 0.9.0) + public_suffix (3.1.0) rainbow (3.0.0) rake (11.3.0) rspec (3.8.0) @@ -44,28 +52,43 @@ GEM rspec-mocks (~> 3.8.0) rspec-core (3.8.0) rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rspec-expectations (3.8.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - rubocop (0.62.0) + rubocop (0.70.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) + parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.4.0) + unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.0) - slop (3.6.0) + safe_yaml (1.0.5) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.20.3) + timecop (0.9.1) + tins (1.20.2) unf (0.1.4) unf_ext - unf_ext (0.0.7.5) - unicode-display_width (1.4.1) - yard (0.9.8) + unf_ext (0.0.7.6) + unicode-display_width (1.6.0) + webmock (3.5.1) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff + yard (0.9.19) + yardstick (0.9.9) + yard (~> 0.8, >= 0.8.7.2) PLATFORMS ruby @@ -81,4 +104,4 @@ DEPENDENCIES zabbixapi! BUNDLED WITH - 1.16.5 + 1.16.6 diff --git a/README.md b/README.md index 2100c02..6a3f43f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Simple and lightweight ruby module for working with [Zabbix][Zabbix] via the [Za [examples]: https://github.com/express42/zabbixapi/tree/master/examples ## Version Policy -We support only two last versions of zabbix (3.4 and 4.0), so you should consider all previous versions deprecated. +We support only two last versions of zabbix (4.0 and 4.2), so you should consider all previous versions deprecated. * Zabbix 1.8.2 (api version 1.2) | zabbixapi 0.6.x | [branch zabbix1.8](https://github.com/express42/zabbixapi/tree/zabbix1.8) * Zabbix 1.8.9 (api version 1.3) | zabbixapi 0.6.x | [branch zabbix1.8](https://github.com/express42/zabbixapi/tree/zabbix1.8) diff --git a/json-1.x.Gemfile b/json-1.x.Gemfile index 626a7d3..c622af5 100644 --- a/json-1.x.Gemfile +++ b/json-1.x.Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -gem 'json', '~> 1.8' +gem 'json', '~> 2.0' gem 'rspec' diff --git a/lib/zabbixapi/client.rb b/lib/zabbixapi/client.rb index a620263..f1cbc0a 100644 --- a/lib/zabbixapi/client.rb +++ b/lib/zabbixapi/client.rb @@ -52,9 +52,8 @@ def initialize(options = {}) @proxy_port = @proxy_uri.port @proxy_user, @proxy_pass = @proxy_uri.userinfo.split(/:/) if @proxy_uri.userinfo end - - unless api_version =~ /(2\.4|3\.[024]|4\.0)\.\d+/ - raise ApiError.new("Zabbix API version: #{api_version} is not support by this version of zabbixapi") + unless api_version =~ %r{^4.[0|2]\.\d+$} + log "[WARN] Zabbix API version: #{api_version} is not supportted by this version of zabbixapi" end @auth_hash = auth