Sha256: 2af4b2c4072ea596df424697b07b9b235ca5ed41cd20ccf962645332236058ef

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module Rapporteur
  class StatusesController < ApplicationController
    def show
      expires_now
      respond_to do |format|
        format.json do
          resource = Rapporteur.run

          if resource.errors.empty?
            render(json: resource)
          else
            display_errors(resource, :json)
          end
        end
      end
    end

    private

    def display_errors(resource, format)
      render(format => { errors: resource.errors }, :status => :internal_server_error)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rapporteur-3.6.2 app/controllers/rapporteur/statuses_controller.rb
rapporteur-3.6.1 app/controllers/rapporteur/statuses_controller.rb