class Mipush::AndroidMessage
Constants
- NOTIFY_TYPE_DEFAULT_ALL
设置通知类型 1 使用默认提示音提示 2 使用默认震动提示 4 使用默认led灯光提示
- NOTIFY_TYPE_DEFAULT_LIGHTS
- NOTIFY_TYPE_DEFAULT_SOUND
- NOTIFY_TYPE_DEFAULT_VIBRATE
- NTF_CENTER_NTF
0 通知栏消息 1 透传消息
- PASS_THROUGH_NTF
Attributes
enable_flow_controll[RW]
notify_id[RW]
notify_type[RW]
pass_through[RW]
payload[RW]
restricted_package_name[RW]
Public Class Methods
new(options={})
click to toggle source
有些参数还没加上
# File lib/mipush/android_message.rb, line 22 def initialize(options={}) @title = options[:title] @description = options[:description] @payload = options[:payload] @pass_through = options[:pass_through] || NTF_CENTER_NTF @notify_type = options[:notify_type] || NOTIFY_TYPE_DEFAULT_SOUND @restricted_package_name = options[:restricted_package_name] @secret_key = options[:secret_key] end
Public Instance Methods
to_params()
click to toggle source
重构这一端烂代码
# File lib/mipush/android_message.rb, line 33 def to_params string = "" string += "title=#{URI.encode @title.to_s}&" unless @title.nil? string += "description=#{URI.encode @description.to_s}&" unless @description.nil? string += "payload=#{URI.encode @payload.to_s}&" unless @payload.nil? string += "pass_through=#{URI.encode @pass_through.to_s}&" unless @pass_through.nil? string += "notify_type=#{URI.encode @notify_type.to_s}&" unless @notify_type.nil? string += "restricted_package_name=#{URI.encode @restricted_package_name.to_s}&" unless @restricted_package_name.nil? string += "extra.notify_effect=1" string end