class ActsAsPushable::GCM::Notification

Attributes

title[RW]

Public Instance Methods

perform() click to toggle source
# File lib/acts_as_pushable/gcm/notification.rb, line 6
def perform
  response = client.send([device.token], gcm_options)
  if response[:not_registered_ids].include? device.token
    device.update_attribute 'invalidated_at', Time.current
  end
  response
end

Private Instance Methods

client() click to toggle source
# File lib/acts_as_pushable/gcm/notification.rb, line 18
def client
  ::GCM.new(ActsAsPushable.configuration.gcm_key)
end
gcm_options() click to toggle source
# File lib/acts_as_pushable/gcm/notification.rb, line 22
def gcm_options
  {
    data: {
      title: title,
      message: message,
    }.merge(payload)
  }
end