lib/ruby-mws/api/response.rb in ruby-mws-0.0.4 vs lib/ruby-mws/api/response.rb in ruby-mws-0.1

- old
+ new

@@ -1,11 +1,13 @@ module MWS module API class Response < Hashie::Rash - def self.parse(hash, name, params) - rash = self.new(hash) + def self.parse(body, name, params) + return body unless body.is_a?(Hash) + + rash = self.new(body) handle_error_response(rash["error_response"]["error"]) unless rash["error_response"].nil? raise BadResponseError, "received non-matching response type #{rash.keys}" if rash["#{name}_response"].nil? rash = rash["#{name}_response"] if rash = rash["#{name}_result"] \ No newline at end of file