16 lines
286 B
Ruby
16 lines
286 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module YiffyAPIUtil
|
||
|
def build_failure_response(code, **data)
|
||
|
{
|
||
|
success: false,
|
||
|
code: code.code,
|
||
|
**data,
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def render_error(code, **)
|
||
|
render(json: build_failure_response(code, **), status: code.status)
|
||
|
end
|
||
|
end
|