Skip to content

Instantly share code, notes, and snippets.

@mariusz-blaszczak
Created August 28, 2018 10:17
Show Gist options
  • Save mariusz-blaszczak/eaa24f37c3dd2bc55cce7b468af1d164 to your computer and use it in GitHub Desktop.
Save mariusz-blaszczak/eaa24f37c3dd2bc55cce7b468af1d164 to your computer and use it in GitHub Desktop.
module Firebase
class PushToAndroid
SERVER_KEY = ENV.fetch('FIREBASE_APP_SERVER_KEY')
def call
registration_ids = User.all.map(&:registration_id)
options = { data: { state: Doors.last_event.attributes }, collapse_key: 'updated_score' }
fcm = FCM.new(SERVER_KEY)
fcm.send(registration_ids, options)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment