Module: RenderServiceResults

Extended by:
ActiveSupport::Concern
Included in:
Metrics::Dashboard::PrometheusApiProxy, MetricsDashboard, Projects::GrafanaApiController
Defined in:
app/controllers/concerns/render_service_results.rb

Instance Method Summary collapse

Instance Method Details

#continue_polling_responseObject


13
14
15
16
17
18
19
20
21
# File 'app/controllers/concerns/render_service_results.rb', line 13

def continue_polling_response
  render({
    status: :no_content,
    json: {
      status: _('processing'),
      message: _('Not ready yet. Try again later.')
    }
  })
end

#error_response(result) ⇒ Object


23
24
25
26
27
28
# File 'app/controllers/concerns/render_service_results.rb', line 23

def error_response(result)
  render({
    status: result[:http_status] || :bad_request,
    json: { status: result[:status], message: result[:message] }
  })
end

#success_response(result) ⇒ Object


6
7
8
9
10
11
# File 'app/controllers/concerns/render_service_results.rb', line 6

def success_response(result)
  render({
    status: result[:http_status],
    json: result[:body]
  })
end