# typed: false # frozen_string_literal: true module Hephaestus module Responses def no_content head(:no_content) end def okay render( json: { message: "OK", }.to_json, status: :ok, ) end def created render( json: { message: "Created", }.to_json, status: :created, ) end def accepted render( json: { errors: [ { message: "Accepted", }, ], }.to_json, status: :accepted, ) end def bad_request render( json: { errors: [ { message: "Bad Request", }, ], }.to_json, status: :bad_request, ) end def forbidden render( json: { errors: [ { message: "Forbidden", }, ], }.to_json, status: :forbidden, ) end def not_acceptable render( json: ::Hephaestus::ErrorSerializer.format("Not Acceptable").to_json, status: :not_acceptable, ) end def not_found render( json: ::Hephaestus::ErrorSerializer.format("Not Found").to_json, status: :not_found, ) end def service_unavailable(msg) render( json: { errors: [ { message: "Service Unavailable: #{msg}", }, ], }.to_json, status: :service_unavailable, ) end def bad_gateway render( json: { errors: [ { message: "Bad Gateway", }, ], }.to_json, status: :bad_gateway, ) end def internal_server_error render( json: { errors: [ { message: "Internal Server Error", }, ], }.to_json, status: :internal_server_error, ) end end end