class JsonapiErrorsHandler::ErrorSerializer
Serializes the given error to match the JSON:API specification
Attributes
error[R]
Public Class Methods
new(error)
click to toggle source
# File lib/jsonapi_errors_handler/error_serializer.rb, line 9 def initialize(error) @error = error end
Public Instance Methods
to_h()
click to toggle source
# File lib/jsonapi_errors_handler/error_serializer.rb, line 13 def to_h serializable_hash end
to_json(_payload = nil)
click to toggle source
# File lib/jsonapi_errors_handler/error_serializer.rb, line 17 def to_json(_payload = nil) to_h.to_json end
Private Instance Methods
serializable_hash()
click to toggle source
# File lib/jsonapi_errors_handler/error_serializer.rb, line 23 def serializable_hash { errors: [error.serializable_hash].flatten } end