lib/pagarme/errors.rb in pagarme-1.10.0 vs lib/pagarme/errors.rb in pagarme-2.0.0
- old
+ new
@@ -11,16 +11,18 @@
self.type = type
self.parameter_name = parameter_name
self.errors = []
end
- def self.initFromServerResponse(response = {})
+ def self.fromServerResponse(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}"
@@ -34,5 +36,6 @@
end
class ResponseError < PagarMeError
end
end
+