Advertisement
NameL3ss

adapters

Sep 2nd, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. module ApnsAdapters
  2. class Sync
  3. def notify(device_token, text, app_name)
  4. notification = Grocer::Notification.new(
  5. device_token: device_token,
  6. alert: text,
  7. )
  8. GrocerFactory.instance.pusher_for(app_name) do |pusher|
  9. pusher.push(notification)
  10. end
  11. end
  12. end
  13. end
  14.  
  15. module ApnsAdapters
  16. class Async
  17. def notify(device_token, text)
  18. Resque.enqueue(ApnsJob, device_token, text)
  19. end
  20. end
  21. end
  22.  
  23. module ApnsAdapters
  24. class Fake
  25. attr_reader :delivered
  26.  
  27. def initialize
  28. clear
  29. end
  30.  
  31. def notify(device_token, text)
  32. @delivered << [device_token, text]
  33. end
  34.  
  35. def clear
  36. @delivered = []
  37. end
  38. end
  39. end
  40.  
  41. set_locales
  42. set_timezone
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement