Class: ApiController
Instance Attribute Summary
#req, #res
Instance Method Summary
collapse
#boolean_param, #csrf_token, #delete_all_images_from_content, #delete_from_storage, #initialize, #params, #redirect_to, #render, #session, #validate!
Instance Method Details
#halt_error(message, status: 400) ⇒ Object
15
16
17
18
|
# File 'app/controllers/api_controller.rb', line 15
def halt_error(message, status: 400)
render_json({ error: message }, status: status)
throw(:halt)
end
|
#render_json(data, status: 200) ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/api_controller.rb', line 5
def render_json(data, status: 200)
@res.status = status
@res.['Content-Type'] = 'application/json'
@res.body << data.to_json
end
|
#status ⇒ Object
11
12
13
|
# File 'app/controllers/api_controller.rb', line 11
def status
render_json({ status: 'ok', version: '1.0.0', type: FEATURES_CONFIG['type'] })
end
|