Sha256: 5846bf9f3aca7d811e6cda6cb9d9336577dbc8115490fcb97194427ead880aab
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require 'xinge/base' module Xinge class Ios < Base ENV_MAP = {'production' => 1, 'development' => 2} def initialize(accessId = nil, secretKey = nil, options = {}) super end def pushToSingleDevice(token, title, content, params={}, custom_content={}) self.push_single_device(token, 0, build_simple_message(title, content, custom_content), params.merge({environment: ENV_MAP[Xinge.config[:env]] || 2})) end def pushToMultiDevices(tokens, title, content, params={}, custom_content={}) self.push_multi_device(tokens, 0, build_simple_message(title, content, custom_content), params.merge({environment: ENV_MAP[Xinge.config[:env]] || 2})) end def pushToAllDevice(title, content, params={}, custom_content={}) self.push_all_device(0, build_simple_message(title, content, custom_content), params.merge({environment: ENV_MAP[Xinge.config[:env]] || 2})) end protected def build_simple_message(title, content, custom_content) { aps: { alert: { title: title, body: content }, sound: 'default', badge: 1 } }.merge(custom_content).to_json end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xinge-for-ruby-0.1.15 | lib/xinge/ios.rb |
xinge-for-ruby-0.1.14 | lib/xinge/ios.rb |
xinge-for-ruby-0.1.13 | lib/xinge/ios.rb |