Sha256: a12801a6eb38449050790b652f2883ef4f28c2b1b385831797d22a1c82b6908c
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'notifiable' require 'ruby-mpns' module Notifiable module Mpns module Nverinaud class SingleNotifier < Notifiable::NotifierBase protected 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 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
notifiable-mpns-nverinaud-0.6.0 | lib/notifiable/mpns/nverinaud/single_notifier.rb |
notifiable-mpns-nverinaud-0.5.0 | lib/notifiable/mpns/nverinaud/single_notifier.rb |