Sha256: 8c43a95cc0710df5e8cfdc91211b92401684e4131a65f709c8b00ce9009dd6e5

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

module Signum
  class SignalController < ApiController
    def show
      signal = Signum::Signal.find(signal_params[:id])
      signal.show! if signal.broadcasted?
      head :ok
    end

    def close
      signal = Signum::Signal.find(signal_params[:id])
      signal.close!
      head :ok
    end

    def close_all
      # signals = Signum.config.current_user.call.signals.where.not(state: "closed") // current_user is nil when called from an api
      signals = current_user.signals.where.not(state: "closed")
      signals.each(&:close!)
      head :ok
    end

    private

    def signal_params
      params.require(:signal).permit(:id)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signum-0.7.4 app/controllers/signum/signal_controller.rb