Sha256: 9c67981460292c1eb7c90c90e8fb90c27e65e05d9b7edfa2b6df32f3d0e2dd5f

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 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', Voltron::Notify::LOG_COLOR
        head :unprocessable_entity
      end
    else
      Voltron.log "SMS Notification with id #{params[:MessageSid]} not found.", 'Notification Update', Voltron::Notify::LOG_COLOR
      head :not_found
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voltron-notify-0.2.0 app/controllers/voltron/notification_controller.rb
voltron-notify-0.1.9 app/controllers/voltron/notification_controller.rb
voltron-notify-0.2.2 app/controllers/voltron/notification_controller.rb
voltron-notify-0.2.1 app/controllers/voltron/notification_controller.rb