zabbix-client 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 +4 -4
- data/lib/zabbix/client/client.rb +9 -7
- data/lib/zabbix/client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8b691bf54ee678deb78e3816ef6476a6ea3d675
|
4
|
+
data.tar.gz: fec1029fe26fb68b7d9a7fc30234665a3ee7b9a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21af3e5d0e95bf6781d5de12977edd1fb83c4e340aa38b79eb409e01185c5a5a1dfe8a03e821a33bae778f58f3629a04a3878683111d7657c50633846ea14998
|
7
|
+
data.tar.gz: e9e437307e46b300e5eb01f5bde87db6cd8706c36d875b7982dcf6b43035020e950757ccfebf53152ca76ce36413865dc4b87518ee517068939fdd6711705a43
|
data/lib/zabbix/client/client.rb
CHANGED
@@ -52,12 +52,14 @@ class Zabbix::Client
|
|
52
52
|
private
|
53
53
|
|
54
54
|
def query(method, params, options)
|
55
|
+
options = (@client.options || {}).merge(options)
|
56
|
+
|
55
57
|
body = {
|
56
58
|
:jsonrpc => JSON_RPC_VERSION,
|
57
59
|
:method => method,
|
58
60
|
:params => params,
|
59
61
|
:id => JSON_RPC_REQUEST_ID,
|
60
|
-
}.merge(options)
|
62
|
+
}.merge(options[:json_rpc_request] || {})
|
61
63
|
|
62
64
|
if @client.auth and not UNAUTHENTICATED_METHODS.include?(method)
|
63
65
|
body[:auth] = @client.auth
|
@@ -65,8 +67,8 @@ class Zabbix::Client
|
|
65
67
|
|
66
68
|
body = JSON.dump(body)
|
67
69
|
|
68
|
-
proxy_user =
|
69
|
-
proxy_password =
|
70
|
+
proxy_user = options[:proxy_user]
|
71
|
+
proxy_password = options[:proxy_password]
|
70
72
|
http = Net::HTTP.Proxy(proxy_user, proxy_password).new(@client.url.host, @client.url.port)
|
71
73
|
|
72
74
|
if @client.url.scheme == 'https'
|
@@ -74,15 +76,15 @@ class Zabbix::Client
|
|
74
76
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
75
77
|
end
|
76
78
|
|
77
|
-
http.set_debug_output($stderr) if
|
79
|
+
http.set_debug_output($stderr) if options[:debug]
|
78
80
|
|
79
81
|
http.start do |h|
|
80
|
-
headers = DEFAULT_HEADERS.merge(
|
82
|
+
headers = DEFAULT_HEADERS.merge(options[:headers] || {})
|
81
83
|
request = Net::HTTP::Post.new(@client.url.path, headers)
|
82
84
|
request.body = body
|
83
85
|
|
84
|
-
basic_auth_user =
|
85
|
-
basic_auth_password =
|
86
|
+
basic_auth_user = options[:basic_auth_user]
|
87
|
+
basic_auth_password = options[:basic_auth_password]
|
86
88
|
|
87
89
|
if basic_auth_user and basic_auth_password
|
88
90
|
request.basic_auth(basic_auth_user, basic_auth_password)
|