require 'grocer' require 'nuge/client' module Nuge module Clients class Grocer < Nuge::Client attr_reader :options def initialize(options = {}) @options = options end def pusher @pusher ||= ::Grocer.pusher(options) end def push(ids, message) notifications(ids, message).each do |notification| pusher.push(notification) end end private def notifications(ids, message) ids.map do |token| ::Grocer::Notification.new( device_token: token, alert: message.delete(:alert), custom: message ) end end end end end