Sha256: 39b6e315e753093f10e103208acbadc3ca058b47bacbb080bbc288305c6ef7c9

Contents?: true

Size: 904 Bytes

Versions: 5

Compression:

Stored size: 904 Bytes

Contents

require 'singleton'
require 'xinge/base'
require 'xinge/ios'
require 'xinge/android'

module Xinge

  class Notification
    include Singleton
    attr_reader :android, :ios
    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
    #发送简单消息到所有 android , ios 设备
    def send_simple_to_all(title, content)
      result = []
      [@android, @ios].each do |sender|
        result << sender.pushToAllDevice(title,content)
      end
      result
    end
    #发送简单消息到指定的设备
    #def send_simple_to_single(token, title, content)
      #result = []
      #[@android, @ios].each do |sender|
        #result << sender.pushToSingleDevice(token, title, content)
      #end
      #result
    #end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-for-xinge-0.1.4 lib/xinge/notification.rb
ruby-for-xinge-0.1.3 lib/xinge/notification.rb
ruby-for-xinge-0.1.2 lib/xinge/notification.rb
ruby-for-xinge-0.1.1 lib/xinge/notification.rb
ruby-for-xinge-0.1.0 lib/xinge/notification.rb