Sha256: 6c17ae3658dc0be79e01a83bc947eca449a697f89c8985afd3366167329dffe9
Contents?: true
Size: 1.82 KB
Versions: 36
Compression:
Stored size: 1.82 KB
Contents
# 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 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
Version data entries
36 entries across 36 versions & 1 rubygems