zabbix-client 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: afe57c5c0df8e0697b078819f389c24800851c5f
4
- data.tar.gz: 39f8ae2f99cd3ad53a1526a89c82021a9c11d08e
3
+ metadata.gz: e8b691bf54ee678deb78e3816ef6476a6ea3d675
4
+ data.tar.gz: fec1029fe26fb68b7d9a7fc30234665a3ee7b9a3
5
5
  SHA512:
6
- metadata.gz: 0d79e5942658df87f604146100f0f5530459ded6190bb9714a01349d87b6e1d25caa98f2e44f8d01968943903b8ca37ef2630ab950edf1d8f4b5ff2c99895b7e
7
- data.tar.gz: fccd34bde530893ec6ebe9095ce73b21f76ed5d0dc56880b0160f2dbf4a3ba1b09e18e38956ea3809dfd85bf0f45f1d60cf03d227d1e18dc1f870d30b6646b3a
6
+ metadata.gz: 21af3e5d0e95bf6781d5de12977edd1fb83c4e340aa38b79eb409e01185c5a5a1dfe8a03e821a33bae778f58f3629a04a3878683111d7657c50633846ea14998
7
+ data.tar.gz: e9e437307e46b300e5eb01f5bde87db6cd8706c36d875b7982dcf6b43035020e950757ccfebf53152ca76ce36413865dc4b87518ee517068939fdd6711705a43
@@ -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 = @client.options[:proxy_user]
69
- proxy_password = @client.options[: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 @client.options[:debug]
79
+ http.set_debug_output($stderr) if options[:debug]
78
80
 
79
81
  http.start do |h|
80
- headers = DEFAULT_HEADERS.merge(@client.options[:headers] || {})
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 = @client.options[:basic_auth_user]
85
- basic_auth_password = @client.options[: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)
@@ -1,5 +1,5 @@
1
1
  module Zabbix
2
2
  class Client
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara