zabbixapi 0.5.3b4 → 0.5.3b5

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,7 +29,7 @@ class ZabbixApi
29
29
  end
30
30
 
31
31
  def delete(data)
32
- result = @client.api_request(:method => "screen.delete", :params => data)
32
+ result = @client.api_request(:method => "screen.delete", :params => [data])
33
33
  result.empty? ? nil : result['screenids'][0].to_i
34
34
  end
35
35
 
@@ -41,27 +41,27 @@ class ZabbixApi
41
41
  valign = data[:valign] || 2
42
42
  halign = data[:halign] || 2
43
43
  vsize = data[:vsize] || ((graphids.size/hsize) + 1).to_i
44
- if screenid = get_id(:name => screen_name)
45
- delete(screenid.to_s)
44
+ screenid = get_id(:name => screen_name)
45
+ unless screenid
46
+ # Create screen
47
+ graphids.each_with_index do |graphid, index|
48
+ screenitems << {
49
+ :resourcetype => 0,
50
+ :resourceid => graphid,
51
+ :x => (index % hsize).to_i,
52
+ :y => (index % graphids.size/hsize).to_i,
53
+ :valign =>valign,
54
+ :halign =>halign
55
+ }
56
+ end
57
+ screenid = create(
58
+ :name => screen_name,
59
+ :hsize => hsize,
60
+ :vsize => vsize,
61
+ :screenitems => screenitems
62
+ )
46
63
  end
47
- # create screan
48
- graphids.each_with_index do |graphid, index|
49
- screenitems << {
50
- :resourcetype => 0,
51
- :resourceid => graphid,
52
- :x => (index % hsize).to_i,
53
- :y => (index % graphids.size/hsize).to_i,
54
- :valign =>valign,
55
- :halign =>halign
56
- }
57
- end
58
-
59
- create(
60
- :name => screen_name,
61
- :hsize => hsize,
62
- :vsize => vsize,
63
- :screenitems => screenitems
64
- )
64
+ screenid
65
65
  end
66
66
 
67
67
  end
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "0.5.3b4"
2
+ VERSION = "0.5.3b5"
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.3b4
4
+ version: 0.5.3b5
5
5
  prerelease: 5
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-01-21 00:00:00.000000000 Z
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: 317957260170769682
101
+ hash: -1581841498466242138
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  none: false
104
104
  requirements: