Class: SwapiDev::ErrorSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- SwapiDev::ErrorSerializer
- Defined in:
- lib/swapi_dev/serializers/error_serializer.rb
Class Method Summary collapse
Class Method Details
.call(content) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/swapi_dev/serializers/error_serializer.rb', line 7 def self.call(content) JSON.parse(content.body, symbolize_names: true).merge( { message: content., code: content.code } ) rescue { message: content., code: content.code, detail: "Try without format or page" } end |