zabbixapi 0.5.9 → 0.6.0

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.
@@ -35,7 +35,7 @@ class ZabbixApi
35
35
 
36
36
  def unlink_templates(data)
37
37
  result = @client.api_request(
38
- :method => "host.massRemove",
38
+ :method => "host.massRemove",
39
39
  :params => {
40
40
  :hostids => data[:hosts_id],
41
41
  :templates => data[:templates_id]
@@ -1,6 +1,6 @@
1
1
  class ZabbixApi
2
2
  class Triggers < Basic
3
-
3
+
4
4
  def array_flag
5
5
  true
6
6
  end
@@ -29,9 +29,9 @@ class ZabbixApi
29
29
  )
30
30
  end
31
31
 
32
- def safe_update(data)
32
+ def safe_update(data)
33
33
  log "[DEBUG] Call update with parametrs: #{data.inspect}"
34
-
34
+
35
35
  dump = {}
36
36
  item_id = data[key.to_sym].to_i
37
37
  dump_by_id(key.to_sym => data[key.to_sym]).each do |item|
@@ -39,17 +39,17 @@ class ZabbixApi
39
39
  end
40
40
 
41
41
  expression = dump[:items][0][:key_]+"."+dump[:functions][0][:function]+"("+dump[:functions][0][:parameter]+")"
42
- dump[:expression] = dump[:expression].gsub(/{(\d*)}/,"{#{expression}}") #TODO ugly regexp
42
+ dump[:expression] = dump[:expression].gsub(/\{(\d*)\}/,"{#{expression}}") #TODO ugly regexp
43
43
  dump.delete(:functions)
44
44
  dump.delete(:items)
45
45
 
46
46
  old_expression = data[:expression]
47
- data[:expression] = data[:expression].gsub(/{.*\:/,"{") #TODO ugly regexp
47
+ data[:expression] = data[:expression].gsub(/\{.*\:/,"{") #TODO ugly regexp
48
48
  data.delete(:templateid)
49
-
49
+
50
50
  log "[DEBUG] expression: #{dump[:expression]}\n data: #{data[:expression]}"
51
51
 
52
- if hash_equals?(dump, data)
52
+ if hash_equals?(dump, data)
53
53
  log "[DEBUG] Equal keys #{dump} and #{data}, skip update"
54
54
  item_id
55
55
  else
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'net/https'
2
3
  require 'net/http'
3
4
 
4
5
  class ZabbixApi
@@ -16,7 +17,7 @@ class ZabbixApi
16
17
 
17
18
  def auth
18
19
  api_request(
19
- :method => 'user.authenticate',
20
+ :method => 'user.authenticate',
20
21
  :params => {
21
22
  :user => @options[:user],
22
23
  :password => @options[:password],
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "0.5.9"
2
+ VERSION = "0.6.0"
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.9
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-26 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project: zabbixapi
107
- rubygems_version: 1.8.25
107
+ rubygems_version: 1.8.23
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: Realization for Zabbix API.