Class: SendleAPI::Errors
- Inherits:
-
ActiveResource::Errors
- Object
- ActiveResource::Errors
- SendleAPI::Errors
- Defined in:
- lib/sendle_api/errors.rb
Instance Method Summary collapse
Instance Method Details
#from_hash(messages, save_cache = false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sendle_api/errors.rb', line 6 def from_hash(, save_cache = false) clear unless save_cache add(:base, ["error_description"]) if ["error_description"] ["messages"].each do |(key, errors)| errors.each do |error| if @base.known_attributes.include?(key) add(key, error) elsif key == "base" add(:base, error) else # reporting an error on an attribute not in attributes # format and add them to base add(:base, "#{key.humanize} #{error}") end end end end |