Method: Rpush::Daemon::Fcm::Delivery#initialize

Defined in:
lib/rpush/daemon/fcm/delivery.rb

#initialize(app, http, notification, batch) ⇒ Delivery

Returns a new instance of Delivery.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rpush/daemon/fcm/delivery.rb', line 11

def initialize(app, http, notification, batch)
  if necessary_data_exists?(app)
    @app = app
    @http = http
    @notification = notification
    @batch = batch

    @uri = URI.parse("#{HOST}/v1/projects/#{@app.firebase_project_id || ENV['FIREBASE_PROJECT_ID']}/messages:send")
  else
    Rpush.logger.error("Cannot find necessary configuration! Please make sure you have set all necessary ENV variables or firebase_project_id and json_key attributes.")
  end
end