class Nuge::Clients::Grocer

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/nuge/clients/grocer.rb, line 9
def initialize(options = {})
  @options = options
end

Public Instance Methods

push(ids, message) click to toggle source
# File lib/nuge/clients/grocer.rb, line 17
def push(ids, message)
  notifications(ids, message).each do |notification|
    pusher.push(notification)
  end
end
pusher() click to toggle source
# File lib/nuge/clients/grocer.rb, line 13
def pusher
  @pusher ||= ::Grocer.pusher(options)
end

Private Instance Methods

notifications(ids, message) click to toggle source
# File lib/nuge/clients/grocer.rb, line 25
def notifications(ids, message)
  ids.map do |token|
    ::Grocer::Notification.new(
      device_token: token,
      alert:        message.delete(:alert),
      custom:       message
    )
  end
end