Exception: Fopost::ValidationError

Inherits:
Error
  • Object
show all
Defined in:
lib/fopost/errors.rb

Overview

400 or 422 — the request body did not pass validation.

Instance Attribute Summary

Attributes inherited from Error

#body, #code, #message, #status

Instance Method Summary collapse

Methods inherited from Error

#initialize, #to_s

Constructor Details

This class inherits a constructor from Fopost::Error

Instance Method Details

#errorsObject

Per-field messages, when the API sends them.



35
36
37
38
# File 'lib/fopost/errors.rb', line 35

def errors
  value = body.is_a?(Hash) ? (body['errors'] || body[:errors]) : nil
  value.is_a?(Hash) || value.is_a?(Array) ? value : nil
end