class Crusade::GCM::Notification

Attributes

channel_id[RW]
subchannel_id[RW]

Public Class Methods

new(notification = {}, channel_id = nil, subchannel_id = nil) click to toggle source
Calls superclass method
# File lib/crusade/gcm/notification.rb, line 10
def initialize(notification = {}, channel_id = nil, subchannel_id = nil)
  if notification.is_a? Hash
    channel_id = notification[:channel_id]
    subchannel_id = notification[:subchannel_id]
    notification = Crusade::Notification.new notification
  end
  super notification
  self.channel_id = channel_id
  self.subchannel_id = subchannel_id
end

Public Instance Methods

to_json() click to toggle source
# File lib/crusade/gcm/notification.rb, line 21
def to_json
  payload.to_json
end

Private Instance Methods

payload() click to toggle source
# File lib/crusade/gcm/notification.rb, line 27
def payload
  {
    channelId:    channel_id,
    subchannelId: subchannel_id,
    payload:      {title: title, body: body}.to_json
  }
end