class Notifiable::Mpns::Nverinaud::SingleNotifier

Protected Instance Methods

enqueue(device_token) click to toggle source
# File lib/notifiable/mpns/nverinaud/single_notifier.rb, line 10
            def enqueue(device_token)
            
data = {title: notification.title, content: notification.message, params: notification.send_params}    

response = MicrosoftPushNotificationService.send_notification(device_token.token, :toast, data)
response_code = response.code.to_i

status_code = 0
case response_code
when 200
when 404
  Rails.logger.info "De-registering device token: #{device_token.id}"
  device_token.update_attribute('is_valid', false)
  status_code = 1
else
  Rails.logger.error "Error sending notification: #{response.code}"  
  status_code = 2            
end

processed(device_token, status_code)
    end