class Maia::FCM::Gateway
Public Class Methods
new(auth = Maia::FCM::Credentials.new)
click to toggle source
# File lib/maia/fcm/gateway.rb, line 4 def initialize(auth = Maia::FCM::Credentials.new) @auth = auth end
Public Instance Methods
deliver(payload)
click to toggle source
# File lib/maia/fcm/gateway.rb, line 8 def deliver(payload) response = Maia::FCM::Response.new connection.write(payload) if response.fail? error = response.error error.payload = payload raise error end response end
serialize(message, target)
click to toggle source
# File lib/maia/fcm/gateway.rb, line 20 def serialize(message, target) Maia::FCM::Serializer.new(message, target).to_json end
Private Instance Methods
connection()
click to toggle source
# File lib/maia/fcm/gateway.rb, line 25 def connection Maia::FCM::Connection.new(@auth.project, @auth.token) end