Class: Unit::UnitError
- Inherits:
-
Object
- Object
- Unit::UnitError
- Defined in:
- lib/unit/errors/unit_error.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Class Method Summary collapse
-
.from_json_api(response) ⇒ UnitError
Creates a new UnitError from given response.
Instance Method Summary collapse
-
#initialize(errors) ⇒ UnitError
constructor
Create a new UnitError.
Constructor Details
#initialize(errors) ⇒ UnitError
Create a new UnitError
12 13 14 |
# File 'lib/unit/errors/unit_error.rb', line 12 def initialize(errors) @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/unit/errors/unit_error.rb', line 8 def errors @errors end |
Class Method Details
.from_json_api(response) ⇒ UnitError
Creates a new UnitError from given response.
19 20 21 |
# File 'lib/unit/errors/unit_error.rb', line 19 def self.from_json_api(response) new((response.body["errors"] || []).map { |error| UnitErrorPayload.from_json_api(error) }) end |