Sha256: 13d0f6bd4e1a2cf868ac484a66e58533d5e5976e74059ab850d237b17958ab52
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require 'notifiable' require 'ruby-mpns' module Notifiable module Mpns module Nverinaud class SingleNotifier < Notifiable::NotifierBase protected def enqueue(notification, device_token) data = {} # title title = notification.provider_value(device_token.provider, :title) data[:title] = title if title # content content = notification.provider_value(device_token.provider, :message) data[:content] = content if content # custom attributes custom_attributes = notification.provider_value(device_token.provider, :params) data.merge!({:params => custom_attributes}) if custom_attributes response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, data case response.code.to_i when 200 processed(notification, device_token) when 404 Rails.logger.info "De-registering device token: #{device_token.id}" device_token.update_attribute('is_valid', false) else Rails.logger.error "Error sending notification: #{response.code}" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notifiable-mpns-nverinaud-0.2.0 | lib/notifiable/mpns/nverinaud/single_notifier.rb |