Class: Xinge::Notification

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/xinge/notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNotification

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

#androidObject (readonly)

Returns the value of attribute android.



10
11
12
# File 'lib/xinge/notification.rb', line 10

def android
  @android
end

#iosObject (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