lib/vacuum/response.rb in vacuum-1.1.1 vs lib/vacuum/response.rb in vacuum-1.2.0

- old
+ new

@@ -1,9 +1,24 @@ require 'delegate' require 'multi_xml' module Vacuum + # A wrapper around the Amazon Product Advertising API response. class Response < SimpleDelegator + class << self + attr_accessor :parser + end + + def parser + @parser || self.class.parser + end + + attr_writer :parser + + def parse + parser ? parser.parse(body) : to_h + end + def to_h MultiXml.parse(body) end def body