lib/emaildirect.rb in emaildirect-1.3.0 vs lib/emaildirect.rb in emaildirect-1.3.1

- old
+ new

@@ -44,14 +44,14 @@ end end # Represents a EmailDirect API error and contains specific data about the error. class EmailDirectError < StandardError - attr_reader :data, :code + attr_reader :data def initialize(data) - @data = data - super "The EmailDirect API responded with the following error - #{@data.ErrorCode}: #{@data.Message}" + @data = Hashie::Mash.new(data) + super "The EmailDirect API responded with the following error - #{data}" end end class ClientError < StandardError; end class ServerError < StandardError; end @@ -89,10 +89,10 @@ def delete(*args); handle_response super end def handle_response(response) # :nodoc: case response.code when 400 - raise BadRequest.new(Hashie::Mash.new response) + raise BadRequest.new response.parsed_response when 401 raise Unauthorized.new when 404 raise NotFound.new when 400...500