lib/pagarme/errors.rb in pagarme-1.9.2 vs lib/pagarme/errors.rb in pagarme-1.9.3

- old
+ new

@@ -1,31 +1,31 @@ module PagarMe class PagarMeError < StandardError - attr_accessor :message - attr_accessor :parameter_name - attr_accessor :type - attr_accessor :url - attr_accessor :errors + attr_accessor :message + attr_accessor :parameter_name + attr_accessor :type + attr_accessor :url + attr_accessor :errors - def initialize(message = "", parameter_name = "", type = "", url = "") - self.message = message - self.type = type - self.parameter_name = parameter_name - self.errors = [] - end + def initialize(message = "", parameter_name = "", type = "", url = "") + self.message = message + self.type = type + self.parameter_name = parameter_name + self.errors = [] + end - def self.initFromServerResponse(response = {}) - object = self.new - response['errors'].map do |error| - object.message += error['message'] + ', ' - object.errors << PagarMeError.new(error['message'], error['parameter_name'], error['type'], response['url']) - end - object - end - - def to_s - "#{self.class.to_s} - #{message}" - end + def self.initFromServerResponse(response = {}) + object = self.new + response['errors'].map do |error| + object.message += error['message'] + ', ' + object.errors << PagarMeError.new(error['message'], error['parameter_name'], error['type'], response['url']) + end + object + end + + def to_s + "#{self.class.to_s} - #{message}" + end end class RequestError < PagarMeError end