dronebl.rb 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/lib/dronebl-client.rb +9 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b176362e9cf954dd9e4bbdd7895c08e726d6732
|
4
|
+
data.tar.gz: 21a9406ef25ae5abb81b2de5f41563f1ce8a1862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9b667e129e0f8548e1342420034f174e336002e9a3bc45b68fed428412b6b27e983d45854eeda3f73e73227a87f24004c3a50322f31474bba2fad91475bd981
|
7
|
+
data.tar.gz: 71a0f48745fc83f232b2ecd481cafedf8f6d5d54aaab3319868027d6799b8308ac74afb736c59418d8c8028e6cdda23af2dd096ecdbe882d4907af124147529f
|
data/lib/dronebl-client.rb
CHANGED
@@ -29,11 +29,16 @@ module DroneBL
|
|
29
29
|
def parse_response xml
|
30
30
|
# This giant mess of hax is needed because the DroneBL response to queries
|
31
31
|
# is encased in CDATA for whatever reason.
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
begin
|
33
|
+
resp = Nokogiri.parse(xml).at("response")
|
34
|
+
if resp['type'].downcase == 'error'
|
35
|
+
abort "call failed: '#{resp.css('message').text}' data: '#{resp.css('data').text}'"
|
36
|
+
end
|
37
|
+
Nokogiri::XML("<?xml version='1.0'>\n<results>#{resp.text}</results>").css("result").map(&:to_h) # thanks to jhass in #ruby on freenode
|
38
|
+
rescue NoMethodError => e
|
39
|
+
puts 'Unfortunately, there was an error parsing the response we got back from the DroneBL servers.'
|
40
|
+
return {}
|
35
41
|
end
|
36
|
-
Nokogiri::XML("<?xml version='1.0'>\n<results>#{resp.text}</results>").css("result").map(&:to_h) # thanks to jhass in #ruby on freenode
|
37
42
|
end
|
38
43
|
|
39
44
|
def gen_lookup_query ips, archived=false
|