Module: Push::Notification::Firebase
- Defined in:
- lib/push/notification/firebase.rb,
lib/push/notification/firebase/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- CREDENTIALS =
JSON.parse(File.read("credentials.json"))
- PRIVATE_KEY =
OpenSSL::PKey::RSA.new CREDENTIALS["private_key"]
- VERSION =
"1.0.0"
Instance Method Summary collapse
Instance Method Details
#processing(message, logger) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/push/notification/firebase.rb', line 16 def processing , logger # Construindo a mensagem = { "message": { "token": ["token"], "notification": { "title": ["title"], "body": ["message"] } } } uri = URI.parse("https://fcm.googleapis.com/v1/projects/fixpayapp-d3d68/messages:send") https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true req = Net::HTTP::Post.new(uri.path) req["Content-Type"] = "application/json" req["Authorization"] = "Bearer #{generate_access_token}" req.body = .to_json https.request(req) logger.info req.body end |