opsview_rest 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/opsview_rest.rb +14 -1
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/opsview_rest.rb CHANGED
@@ -85,6 +85,19 @@ class OpsviewRest
85
85
  get("config/#{options[:type]}")
86
86
  end
87
87
 
88
+ def find(options = {})
89
+ options = {
90
+ :type => "host",
91
+ :name => nil
92
+ }.update options
93
+
94
+ unless name
95
+ raise "Need to specify the name of the object."
96
+ else
97
+ get("config/#{options[:type]}?s.name=#{options[:name]}", :rows => :all)
98
+ end
99
+ end
100
+
88
101
  def purge(options = {})
89
102
  options = {
90
103
  :type => "host",
@@ -94,7 +107,7 @@ class OpsviewRest
94
107
  unless name
95
108
  raise "Need to specify the name of the object."
96
109
  else
97
- id = get("config/#{options[:type]}?s.name=#{options[:name]}", :rows => :all)[0]["id"]
110
+ id = find(:type => options[:type], :name => options[:name])[0]["id"]
98
111
  delete("config/#{options[:type]}/#{id}")
99
112
  end
100
113
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsview_rest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Paredes