如何在Ruby on Rails上使用Firebase?

[英]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.

我看過不同的紅寶石寶石,比如firebase-ruby和rest-firebase,但是這些寶石與鐵軌沒有很好的整合。

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

我的問題是,使用FireRecord設計模式作為我的后端有一種更簡單的方法嗎?

1 个解决方案

#1


14  

Firstly you need to get two things
1) FIREBASE_SERVER_API_KEY
2) FIREBASE_NOTIFICATION_URL.

首先,您需要獲得兩件事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":{}}

I have also created a tutorial how to integrate Firebase with ruby on rails

我還創建了一個教程如何將Firebase與ruby集成在rails上


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/12/13/e37ee0ea7aeec647f139ae41e25a9dc8.html



 
  © 2014-2022 ITdaan.com 联系我们: