lib/peddler/xml_response_parser.rb in peddler-1.4.1 vs lib/peddler/xml_response_parser.rb in peddler-1.5.0
- old
+ new
@@ -1,19 +1,21 @@
require 'peddler/xml_parser'
module Peddler
# @api private
class XMLResponseParser < XMLParser
+ MATCHER = /Message|Report|Result/
+ private_constant :MATCHER
+
def next_token
parse.fetch('NextToken', false)
end
private
def find_data
payload = xml.values.first
- found = payload.find { |k, _| k.include?('Result') } ||
- payload.find { |k, _| k == 'Message' }
+ found = payload.find { |k, _| k.match(MATCHER) }
found.last if found
end
end
end