ruby-splunk 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/splunk.rb +16 -14
  2. metadata +2 -2
data/lib/splunk.rb CHANGED
@@ -21,26 +21,28 @@ class Splunk
21
21
  xml = Nori.parse api_request("#{@uri}/search/jobs/export", *data).body
22
22
  raise "Search failed: #{xml["response"]["messages"]["msg"]}" if xml.has_key? "response"
23
23
  ret = Array.new
24
- xml["results"]["result"].each do |result|
25
- rres = Hash.new
26
- result["field"].each do |field|
27
- if field.has_key? "@k"
28
- case field["@k"]
29
- when '_raw'
30
- rres[:"#{field["@k"]}"] = field["v"].to_s
31
- when '_si'
32
- # FIXME do nothing - we don't handle this yet
33
- else
24
+ if xml["results"]["result"]
25
+ xml["results"]["result"].each do |result|
26
+ rres = Hash.new
27
+ result["field"].each do |field|
28
+ if field.has_key? "@k"
34
29
  case field["@k"]
35
- when '_time'
36
- rres[:"#{field["@k"]}"] = Time.parse field["value"]["text"].to_s
30
+ when '_raw'
31
+ rres[:"#{field["@k"]}"] = field["v"].to_s
32
+ when '_si'
33
+ # FIXME do nothing - we don't handle this yet
37
34
  else
38
- rres[:"#{field["@k"]}"] = field["value"]["text"].to_s
35
+ case field["@k"]
36
+ when '_time'
37
+ rres[:"#{field["@k"]}"] = Time.parse field["value"]["text"].to_s
38
+ else
39
+ rres[:"#{field["@k"]}"] = field["value"]["text"].to_s
40
+ end
39
41
  end
40
42
  end
41
43
  end
42
- end
43
44
  ret << rres
45
+ end
44
46
  end
45
47
  ret
46
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-splunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2012-04-23 00:00:00.000000000 +01:00
12
+ date: 2012-04-24 00:00:00.000000000 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
  description: Splunk API Library for Ruby