class Pushing::Adapters::AndpushAdapter
Attributes
server_key[R]
Public Class Methods
new(fcm_settings)
click to toggle source
# File lib/pushing/adapters/fcm/andpush_adapter.rb, line 11 def initialize(fcm_settings) @server_key = fcm_settings.server_key end
Public Instance Methods
push!(notification)
click to toggle source
# File lib/pushing/adapters/fcm/andpush_adapter.rb, line 15 def push!(notification) FcmResponse.new(client.push(notification.payload)) rescue => e response = e.respond_to?(:response) ? FcmResponse.new(e.response) : nil error = Pushing::FcmDeliveryError.new("Error while trying to send push notification: #{e.message}", response, notification) raise error, error.message, e.backtrace end
Private Instance Methods
client()
click to toggle source
# File lib/pushing/adapters/fcm/andpush_adapter.rb, line 26 def client @client ||= Andpush.build(server_key) end