Class: Maia::FCM::Platform::APNS
- Inherits:
-
Object
- Object
- Maia::FCM::Platform::APNS
- Defined in:
- lib/maia/fcm/platform/apns.rb
Instance Method Summary collapse
- #badge ⇒ Object
-
#initialize(message) ⇒ APNS
constructor
A new instance of APNS.
- #priority ⇒ Object
- #sound ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(message) ⇒ APNS
Returns a new instance of APNS.
5 6 7 |
# File 'lib/maia/fcm/platform/apns.rb', line 5 def initialize() @message = end |
Instance Method Details
#badge ⇒ Object
9 10 11 |
# File 'lib/maia/fcm/platform/apns.rb', line 9 def badge @message.badge end |
#priority ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/maia/fcm/platform/apns.rb', line 17 def priority if @message.priority == :high && !@message.background? 10 else 5 end end |
#sound ⇒ Object
13 14 15 |
# File 'lib/maia/fcm/platform/apns.rb', line 13 def sound @message.sound end |
#to_h ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/maia/fcm/platform/apns.rb', line 25 def to_h { headers: { 'apns-priority': priority.to_s }.compact, payload: { aps: { badge: badge, sound: sound, 'content-available': (1 if @message.background?) }.compact } } end |