zabbix-api-simple 0.2.2 → 0.2.4
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 +4 -4
- data/CHANGELOG.md +3 -1
- data/lib/zabbix/api/client.rb +8 -1
- data/lib/zabbix/api/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f1917db81096d5ae359d77f44c48015cf869940668d038ea2f475e34d9c93d3
|
|
4
|
+
data.tar.gz: bbd2d590be81dae265c497e9795e9c675ae7f0a467b7f26b320d2a004b90a0cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 474fb8a339d91eb2fc95adf4fabb2a08a4e3eeaa7b8e05f7b835975a04c0fa3a45cbe71d55581c4205f522d6de3054d03009326cb5f55c31e016fcc101f71f56
|
|
7
|
+
data.tar.gz: b1ffdff531c376b3001f2c548560b75263f78c09fcba59da0e08733d13fab01324dc86c26e96d6a98a4934bfde048121947c9d32389ac3de6abf7a76de1de747
|
data/CHANGELOG.md
CHANGED
|
@@ -11,5 +11,7 @@
|
|
|
11
11
|
- force faraday 1.8 - 2.0 appears to break things
|
|
12
12
|
# 0.2.0
|
|
13
13
|
- changes to support faraday 2.0. Note that faraday < 2.0 is incompatible with 2.0+ - when you install zabbix-api-simple 0.2.0 it will install faraday 2.0
|
|
14
|
-
# 0.2.1
|
|
14
|
+
# 0.2.1 & 0.2.2
|
|
15
15
|
- another faraday fix
|
|
16
|
+
# 0.2.3
|
|
17
|
+
- fix for zabbix server >= 6.4.0 api login param change (user => username)
|
data/lib/zabbix/api/client.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
module Zabbix
|
|
2
2
|
module Api
|
|
3
|
+
UsernameChangeVersion = "6.4.0"
|
|
3
4
|
|
|
4
5
|
require 'faraday'
|
|
5
6
|
require 'faraday/net_http'
|
|
6
7
|
require 'json'
|
|
7
8
|
require 'set'
|
|
8
9
|
require 'amazing_print'
|
|
10
|
+
require 'ostruct'
|
|
9
11
|
require 'pry'
|
|
10
12
|
|
|
11
13
|
module FaradayMiddleware
|
|
@@ -139,7 +141,12 @@ module Zabbix
|
|
|
139
141
|
# both :user and :pass are required. This method calls user.logic
|
|
140
142
|
# abd stores the returned auth token for future calls to the api
|
|
141
143
|
def login(user: nil,pass: nil)
|
|
142
|
-
|
|
144
|
+
version = call('apiinfo.version',{}).result
|
|
145
|
+
if version < UsernameChangeVersion
|
|
146
|
+
res =post(method: 'user.login', params: {user: user, password:pass}, auth:nil)
|
|
147
|
+
else
|
|
148
|
+
res =post(method: 'user.login', params: {username: user, password:pass}, auth:nil)
|
|
149
|
+
end
|
|
143
150
|
@token = res.body['result']
|
|
144
151
|
OpenStruct.new(res.body)
|
|
145
152
|
end
|
data/lib/zabbix/api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zabbix-api-simple
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Parker
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: faraday
|
|
@@ -143,7 +142,6 @@ metadata:
|
|
|
143
142
|
homepage_uri: https://svdasein.gitlab.io/zabbix-api
|
|
144
143
|
source_code_uri: https://gitlab.com/svdasein/zabbix-api
|
|
145
144
|
changelog_uri: https://gitlab.com/svdasein/zabbix-api/-/blob/master/CHANGELOG.md
|
|
146
|
-
post_install_message:
|
|
147
145
|
rdoc_options: []
|
|
148
146
|
require_paths:
|
|
149
147
|
- lib
|
|
@@ -158,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
158
156
|
- !ruby/object:Gem::Version
|
|
159
157
|
version: '0'
|
|
160
158
|
requirements: []
|
|
161
|
-
rubygems_version: 3.
|
|
162
|
-
signing_key:
|
|
159
|
+
rubygems_version: 3.6.7
|
|
163
160
|
specification_version: 4
|
|
164
161
|
summary: Zabbix API wrapper
|
|
165
162
|
test_files: []
|