Module: Spreedly::ErrorsParser

Included in:
PaymentMethod, XmlErrorsList
Defined in:
lib/spreedly/common/errors_parser.rb

Instance Method Summary collapse

Instance Method Details

#errors_from(xml_doc) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/spreedly/common/errors_parser.rb', line 4

def errors_from(xml_doc)
  xml_doc.xpath(".//errors/error").map do |each|
    {
      attribute: each.attributes['attribute'].to_s,
      key: each.attributes['key'].to_s,
      message: each.text
    }
  end
end