Class: JsonapiErrorsHandler::ErrorSerializer
- Inherits:
-
Object
- Object
- JsonapiErrorsHandler::ErrorSerializer
- Defined in:
- lib/jsonapi_errors_handler/error_serializer.rb
Overview
Serializes the given error to match the JSON:API specification
Instance Method Summary collapse
-
#initialize(error) ⇒ ErrorSerializer
constructor
A new instance of ErrorSerializer.
- #to_h ⇒ Object
- #to_json(_payload = nil) ⇒ Object
Constructor Details
#initialize(error) ⇒ ErrorSerializer
Returns a new instance of ErrorSerializer.
9 10 11 |
# File 'lib/jsonapi_errors_handler/error_serializer.rb', line 9 def initialize(error) @error = error end |
Instance Method Details
#to_h ⇒ Object
13 14 15 |
# File 'lib/jsonapi_errors_handler/error_serializer.rb', line 13 def to_h serializable_hash end |
#to_json(_payload = nil) ⇒ Object
17 18 19 |
# File 'lib/jsonapi_errors_handler/error_serializer.rb', line 17 def to_json(_payload = nil) to_h.to_json end |