chockstone 0.2.0 → 0.3.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.
- data/.gitignore +2 -1
- data/README.rdoc +1 -1
- data/chockstone.gemspec +1 -1
- data/lib/chockstone/connection.rb +10 -8
- metadata +2 -2
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
data/chockstone.gemspec
CHANGED
@@ -126,23 +126,27 @@ module Chockstone
|
|
126
126
|
p = XML::Parser.string(resp)
|
127
127
|
doc = p.parse
|
128
128
|
|
129
|
-
#puts "RESPONSE: " + doc.to_s
|
130
|
-
|
131
129
|
response = doc.find('//response')[0]
|
132
130
|
status = response.find('//status')[0]
|
131
|
+
|
132
|
+
alert_name = status.find('//alert-name')[0]
|
133
|
+
alert_type = status.find('//alert-type')[0]
|
134
|
+
|
135
|
+
alert = {
|
136
|
+
:name => alert_name ? alert_name.content : nil,
|
137
|
+
:type => alert_type ? alert_type.content : nil
|
138
|
+
}
|
139
|
+
|
133
140
|
method = status.find('//type')[0].content
|
134
141
|
data = Hash.from_xml(response.find("//#{method}")[0].to_s)
|
135
142
|
|
136
143
|
formatted_response = {
|
137
144
|
:status => status.find('//code')[0].content,
|
138
|
-
:alert => {
|
139
|
-
:name => code = status.find('//alert-name')[0].content,
|
140
|
-
:type => code = status.find('//alert-type')[0].content
|
141
|
-
},
|
142
145
|
:method => method,
|
143
146
|
:description => status.find('//description')[0].content
|
144
147
|
}
|
145
148
|
|
149
|
+
formatted_response.merge!({ :alert => alert }) unless alert[:name].nil? and alert[:type].nil?
|
146
150
|
formatted_response.merge!({ :data => data }) unless data.blank?
|
147
151
|
|
148
152
|
formatted_response
|
@@ -167,8 +171,6 @@ module Chockstone
|
|
167
171
|
req.attributes['version'] = '1'
|
168
172
|
req.attributes['revision'] = '1'
|
169
173
|
|
170
|
-
#puts "REQUEST: " + xml.to_s
|
171
|
-
|
172
174
|
send(xml)
|
173
175
|
end
|
174
176
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chockstone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2012-04-
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: libxml-ruby
|