lib/pagarme/errors.rb in pagarme-2.1.3 vs lib/pagarme/errors.rb in pagarme-2.1.4

- old
+ new

@@ -40,16 +40,24 @@ params = error.values_at('message', 'parameter_name', 'type', 'url') ParamError.new(*params) end super @errors.map(&:message).join(', ') end + + def to_h + @errors.map(&:to_h) + end end class ParamError < PagarMeError attr_reader :parameter_name, :type, :url def initialize(message, parameter_name, type, url) @parameter_name, @type, @url = parameter_name, type, url super message + end + + def to_h + { parameter_name: parameter_name , type: type , message: message } end end end