Class: Pntfr::Session::Android
- Defined in:
- lib/pntfr/session/android.rb
Instance Attribute Summary collapse
-
#gcm ⇒ Object
readonly
Returns the value of attribute gcm.
Instance Method Summary collapse
-
#initialize(notification_key = nil) ⇒ Android
constructor
A new instance of Android.
- #notify(push_ids, data) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(notification_key = nil) ⇒ Android
Returns a new instance of Android.
11 12 13 14 15 16 |
# File 'lib/pntfr/session/android.rb', line 11 def initialize notification_key=nil if notification_key.nil? notification_key= Pntfr.config.gcm[:notification_key] end @gcm= ::GCM.new(notification_key) end |
Instance Attribute Details
#gcm ⇒ Object (readonly)
Returns the value of attribute gcm.
9 10 11 |
# File 'lib/pntfr/session/android.rb', line 9 def gcm @gcm end |
Instance Method Details
#notify(push_ids, data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pntfr/session/android.rb', line 18 def notify(push_ids, data) = {data: data} if Pntfr.test_env? push_ids.each { |push_id| Pntfr.add_delivery(push_id, ) } Session::SuccessResponse.new else rs= @gcm.send_notification(push_ids, ) parse_response rs end end |