Class: Unit::UnitErrorPayload
- Inherits:
-
Object
- Object
- Unit::UnitErrorPayload
- Defined in:
- lib/unit/errors/unit_error_payload.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
-
.from_json_api(error) ⇒ UnitErrorPayload
Creates a new UnitErrorPayload from given response error.
Instance Method Summary collapse
-
#initialize(title, status, detail, details = nil, source = nil, code = nil) ⇒ UnitErrorPayload
constructor
Check out documentation link for more details: docs.unit.co/about-jsonapi/#intro-errors.
Constructor Details
#initialize(title, status, detail, details = nil, source = nil, code = nil) ⇒ UnitErrorPayload
Check out documentation link for more details: docs.unit.co/about-jsonapi/#intro-errors
14 15 16 17 18 19 20 21 |
# File 'lib/unit/errors/unit_error_payload.rb', line 14 def initialize(title, status, detail, details = nil, source = nil, code = nil) @title = title @status = status @detail = detail @details = details @source = source @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/unit/errors/unit_error_payload.rb', line 5 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
5 6 7 |
# File 'lib/unit/errors/unit_error_payload.rb', line 5 def detail @detail end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
5 6 7 |
# File 'lib/unit/errors/unit_error_payload.rb', line 5 def details @details end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/unit/errors/unit_error_payload.rb', line 5 def source @source end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/unit/errors/unit_error_payload.rb', line 5 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/unit/errors/unit_error_payload.rb', line 5 def title @title end |
Class Method Details
.from_json_api(error) ⇒ UnitErrorPayload
Creates a new UnitErrorPayload from given response error.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/unit/errors/unit_error_payload.rb', line 26 def self.from_json_api(error) new( error["title"], error["status"], error["detail"], error["details"], error["source"], error["code"] ) end |