zabbixapi 0.5.1b2 → 0.5.1b3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
1
  class Hash
2
- def deep_include?(sub_hash)
2
+
3
+ def deep_include?(sub_hash, without_key)
3
4
  sub_hash.keys.all? do |key|
5
+ next if key == without_key
4
6
  self.has_key?(key) && if sub_hash[key].is_a?(Hash)
5
7
  self[key].is_a?(Hash) && self[key].deep_include?(sub_hash[key])
6
8
  else
@@ -8,6 +10,7 @@ class Hash
8
10
  end
9
11
  end
10
12
  end
13
+
11
14
  end
12
15
 
13
16
  class ZabbixApi
@@ -20,16 +20,20 @@ class ZabbixApi
20
20
  end
21
21
 
22
22
  def update(data)
23
+
23
24
  dump = {}
25
+ item_id = data[key.to_sym].to_i
24
26
  get_full_data(data).each do |item|
25
27
  dump = symbolize_keys(item) if item[key].to_i == data[key.to_sym].to_i
26
28
  end
27
- unless dump.deep_include?(data)
28
- result = @client.api_request(:method => "#{method_name}.update", :params => data)
29
+
30
+ unless dump.deep_include?(data, key.to_sym)
31
+ result = @client.api_request(:method => "#{method_name}.update", :params => data)
29
32
  parse_keys result
30
33
  else
31
- data[key.to_sym].to_i
34
+ item_id
32
35
  end
36
+
33
37
  end
34
38
 
35
39
  def get_full_data(data)
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "0.5.1b2"
2
+ VERSION = "0.5.1b3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbixapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1b2
4
+ version: 0.5.1b3
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -61,6 +61,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
61
  - - ! '>='
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
+ segments:
65
+ - 0
66
+ hash: 4489570165643587078
64
67
  required_rubygems_version: !ruby/object:Gem::Requirement
65
68
  none: false
66
69
  requirements:
@@ -76,4 +79,3 @@ summary: Realization for Zabbix API.
76
79
  test_files:
77
80
  - spec/localhost.rb
78
81
  - spec/run.rb
79
- has_rdoc: