Sha256: d0692ef65bf1ca49e84feb7b5c4dedc9862b06393cb81ebf0007fe7f63dcb44d

Contents?: true

Size: 524 Bytes

Versions: 190

Compression:

Stored size: 524 Bytes

Contents

# frozen_string_literal: true

module Motor
  class SendAlertsController < ApiBaseController
    wrap_parameters :data

    before_action :build_alert, only: :create
    authorize_resource :alert, only: :create

    def create
      AlertsMailer.alert_email(@alert).deliver_now!

      head :ok
    end

    private

    def build_alert
      @alert = Motor::Alerts::Persistance.build_from_params(alert_params)
    end

    def alert_params
      params.require(:data).permit(:query_id, :name, :to_emails)
    end
  end
end

Version data entries

190 entries across 190 versions & 2 rubygems

Version Path
motor-admin-0.3.17 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.16 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.15 app/controllers/motor/send_alerts_controller.rb
mafia-admin-0.3.18 app/controllers/motor/send_alerts_controller.rb
mafia-admin-0.3.17 app/controllers/motor/send_alerts_controller.rb
mafia-admin-0.3.16 app/controllers/motor/send_alerts_controller.rb
mafia-admin-0.3.15 app/controllers/motor/send_alerts_controller.rb
mafia-admin-0.3.14 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.14 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.13 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.12 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.11 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.10 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.9 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.8 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.7 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.6 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.5 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.4 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.3.3 app/controllers/motor/send_alerts_controller.rb