Exception: Cashboard::BadRequest
- Defined in:
- lib/cashboard/errors.rb
Instance Attribute Summary
Attributes inherited from HTTPError
Instance Method Summary collapse
-
#errors ⇒ Object
Returns a hash of errors keyed on field name.
-
#to_s ⇒ Object
Custom parses our “errors” return XML.
Methods inherited from HTTPError
Constructor Details
This class inherits a constructor from Cashboard::HTTPError
Instance Method Details
#errors ⇒ Object
Returns a hash of errors keyed on field name.
Return Example
{
:field_name_one => "Error message",
:field_name_two => "Error message"
}
39 40 41 42 43 44 45 46 |
# File 'lib/cashboard/errors.rb', line 39 def errors parsed_errors = XmlSimple.xml_in(response.response.body) error_hash = {} parsed_errors['error'].each do |e| error_hash[e['field']] = e['content'] end return error_hash end |
#to_s ⇒ Object
Custom parses our “errors” return XML
28 29 30 |
# File 'lib/cashboard/errors.rb', line 28 def to_s response.response.body end |