class Xinge::Ios

Constants

ENV_MAP

Public Class Methods

new(accessId = nil, secretKey = nil, options = {}) click to toggle source
Calls superclass method Xinge::Base::new
# File lib/xinge/ios.rb, line 7
def initialize(accessId = nil, secretKey = nil, options = {})
  super
end

Public Instance Methods

pushToAllDevice(title, content, params={}, custom_content={}) click to toggle source
# File lib/xinge/ios.rb, line 13
def pushToAllDevice(title, content, params={}, custom_content={})
  self.push_all_device(1, build_simple_message(title, content, custom_content), params.merge({environment: ENV_MAP[Xinge.config[:env]]}))
end
pushToSingleDevice(token, title, content, params={}, custom_content={}) click to toggle source
# File lib/xinge/ios.rb, line 10
def pushToSingleDevice(token, title, content, params={}, custom_content={})
  self.push_single_device(token, 1, build_simple_message(title, content, custom_content), params.merge({environment: ENV_MAP[Xinge.config[:env]]}))
end

Protected Instance Methods

build_simple_message(title, content, custom_content) click to toggle source
# File lib/xinge/ios.rb, line 19
def build_simple_message(title, content, custom_content)
  {
    aps: {
      alert: {
        title: title,
        body: content
      },
      sound: 'default',
      badge: 1
    }
  }.merge(custom_content).to_json
end