Class: Xinge::Notification
- Inherits:
-
Object
- Object
- Xinge::Notification
- Includes:
- Singleton
- Defined in:
- lib/xinge/notification.rb
Instance Attribute Summary collapse
-
#android ⇒ Object
readonly
Returns the value of attribute android.
-
#ios ⇒ Object
readonly
Returns the value of attribute ios.
Instance Method Summary collapse
-
#initialize ⇒ Notification
constructor
A new instance of Notification.
-
#send_simple_to_all(title, content) ⇒ Object
发送简单消息到所有 android , ios 设备.
Constructor Details
#initialize ⇒ Notification
Returns a new instance of Notification.
11 12 13 14 |
# File 'lib/xinge/notification.rb', line 11 def initialize @android = Xinge::Android.new(Xinge.config[:android_accessId], Xinge.config[:android_secretKey]) @ios = Xinge::Ios.new(Xinge.config[:ios_accessId], Xinge.config[:ios_secretKey]) end |
Instance Attribute Details
#android ⇒ Object (readonly)
Returns the value of attribute android.
10 11 12 |
# File 'lib/xinge/notification.rb', line 10 def android @android end |
#ios ⇒ Object (readonly)
Returns the value of attribute ios.
10 11 12 |
# File 'lib/xinge/notification.rb', line 10 def ios @ios end |
Instance Method Details
#send_simple_to_all(title, content) ⇒ Object
发送简单消息到所有 android , ios 设备
16 17 18 19 20 21 22 |
# File 'lib/xinge/notification.rb', line 16 def send_simple_to_all(title, content) result = [] [@android, @ios].each do |sender| result << sender.pushToAllDevice(title,content) end result end |