class Rpush::Daemon::Wns::PostRequest
Public Class Methods
create(notification, access_token)
click to toggle source
# File lib/rpush/daemon/wns/post_request.rb, line 5 def self.create(notification, access_token) stringify_keys(notification.data) unless notification.data.nil? if raw_notification?(notification) RawRequest.create(notification, access_token) elsif badge_notification?(notification) BadgeRequest.create(notification, access_token) else ToastRequest.create(notification, access_token) end end
Private Class Methods
badge_notification?(notification)
click to toggle source
# File lib/rpush/daemon/wns/post_request.rb, line 23 def self.badge_notification?(notification) notification.class.name.match(/BadgeNotification/) end
raw_notification?(notification)
click to toggle source
# File lib/rpush/daemon/wns/post_request.rb, line 19 def self.raw_notification?(notification) notification.class.name.match(/RawNotification/) end
stringify_keys(data)
click to toggle source
# File lib/rpush/daemon/wns/post_request.rb, line 27 def self.stringify_keys(data) data.keys.each { |key| data[key.to_s || key] = data.delete(key) } end