Sha256: 019119910d2aaf2b7024cf1ea74a74c82264ba51ac03b6e2c79d9ea9e8047d6e

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

class Voltron::NotificationController < ApplicationController

  skip_before_action :verify_authenticity_token

  def update
    if Voltron::Notification::SmsNotification.exists?(sid: params[:MessageSid])
      sms = Voltron::Notification::SmsNotification.find_by(sid: params[:MessageSid])
      update_params = { status: params[:MessageStatus], error_code: params[:ErrorCode] }.compact
      if sms.update(update_params)
        head :ok
      else
        Voltron.log "(SID: #{params[:MessageSid]}) " + sms.errors.full_messages.join(""), "Notification Update", :light_yellow
        head :unprocessable_entity
      end
    else
      Voltron.log "SMS Notification with id #{params[:MessageSid]} not found.", "Notification Update", :light_yellow
      head :not_found
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
voltron-notify-0.1.6 app/controllers/voltron/notification_controller.rb
voltron-notify-0.1.8 app/controllers/voltron/notification_controller.rb
voltron-notify-0.1.7 app/controllers/voltron/notification_controller.rb