dronebl.rb 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dronebl-client.rb +9 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 535c314f2f6812cc8191688d6abd93ff4816fbbd
4
- data.tar.gz: 8fd7dd4258b986eb89eb92ee80da5f6769b85a49
3
+ metadata.gz: 6b176362e9cf954dd9e4bbdd7895c08e726d6732
4
+ data.tar.gz: 21a9406ef25ae5abb81b2de5f41563f1ce8a1862
5
5
  SHA512:
6
- metadata.gz: 62b2a44d0ea9505e772591d88dccbf3df6ccd3f465564babf620391e2ecc7cdb637746c2cc7e01310c7edc8eef7bbafa7c31f9fed8e400b0f6726911891fcebf
7
- data.tar.gz: 3819c6847e3410a60cd96e1133a153eb784d9e969a6a9bb85d7253a553ccaa67506e1864ced334cc8cf5eccf0a0222e9ca2e3ff744e1c6d45b89d0309dac54d2
6
+ metadata.gz: f9b667e129e0f8548e1342420034f174e336002e9a3bc45b68fed428412b6b27e983d45854eeda3f73e73227a87f24004c3a50322f31474bba2fad91475bd981
7
+ data.tar.gz: 71a0f48745fc83f232b2ecd481cafedf8f6d5d54aaab3319868027d6799b8308ac74afb736c59418d8c8028e6cdda23af2dd096ecdbe882d4907af124147529f
@@ -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
- resp = Nokogiri::XML(xml).at("response")
33
- if resp['type'].downcase == 'error'
34
- abort "call failed: '#{resp.css('message').text}' data: '#{resp.css('data').text}'"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dronebl.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rylee Fowler