ntholi
ntholi

Reputation: 928

How to use Firebase with Ruby on Rails?

I've looked at different ruby gems like firebase-ruby and rest-firebase, but the gems don't integrate well with rails.

My question is, is there an easier way of using the ApplicationRecord design pattern with Firebase as my backend?

Upvotes: 12

Views: 15433

Answers (1)

Aniket Tiwari
Aniket Tiwari

Reputation: 3998

Firstly you need to get two things

  1. FIREBASE_SERVER_API_KEY
  2. FIREBASE_NOTIFICATION_URL.

After that just pass these in headers

{"Authorization" => "key=#{FIREBASE_SERVER_API_KEY}", "Content-Type" => "application/json"}

And in body pass these

{"registration_ids":
["pass-device-token"],
"priority":"high",
"data":{}}

Upvotes: 17

Related Questions