Class: Pushing::Adapters::AndpushAdapter
- Inherits:
-
Object
- Object
- Pushing::Adapters::AndpushAdapter
- Defined in:
- lib/pushing/adapters/fcm/andpush_adapter.rb
Instance Attribute Summary collapse
-
#server_key ⇒ Object
readonly
Returns the value of attribute server_key.
Instance Method Summary collapse
-
#initialize(fcm_settings) ⇒ AndpushAdapter
constructor
A new instance of AndpushAdapter.
- #push!(notification) ⇒ Object
Constructor Details
#initialize(fcm_settings) ⇒ AndpushAdapter
Returns a new instance of AndpushAdapter.
11 12 13 |
# File 'lib/pushing/adapters/fcm/andpush_adapter.rb', line 11 def initialize(fcm_settings) @server_key = fcm_settings.server_key end |
Instance Attribute Details
#server_key ⇒ Object (readonly)
Returns the value of attribute server_key.
9 10 11 |
# File 'lib/pushing/adapters/fcm/andpush_adapter.rb', line 9 def server_key @server_key end |
Instance Method Details
#push!(notification) ⇒ Object
15 16 17 18 19 20 21 22 |
# 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., e.backtrace end |