Class: Mipush::AndroidMessage
- Defined in:
- lib/mipush/android_message.rb
Constant Summary collapse
- NOTIFY_TYPE_DEFAULT_ALL =
设置通知类型 1 使用默认提示音提示 2 使用默认震动提示 4 使用默认led灯光提示
-1
- NOTIFY_TYPE_DEFAULT_SOUND =
1
- NOTIFY_TYPE_DEFAULT_VIBRATE =
2
- NOTIFY_TYPE_DEFAULT_LIGHTS =
4
- NTF_CENTER_NTF =
0 通知栏消息 1 透传消息
0
- PASS_THROUGH_NTF =
1
Instance Attribute Summary collapse
-
#enable_flow_controll ⇒ Object
Returns the value of attribute enable_flow_controll.
-
#notify_id ⇒ Object
Returns the value of attribute notify_id.
-
#notify_type ⇒ Object
Returns the value of attribute notify_type.
-
#pass_through ⇒ Object
Returns the value of attribute pass_through.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#restricted_package_name ⇒ Object
Returns the value of attribute restricted_package_name.
Attributes inherited from Message
#description, #extra, #secret_key, #time_to_live, #time_to_send, #title
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AndroidMessage
constructor
有些参数还没加上.
-
#to_params ⇒ Object
重构这一端烂代码.
Constructor Details
#initialize(options = {}) ⇒ AndroidMessage
有些参数还没加上
22 23 24 25 26 27 28 29 30 |
# File 'lib/mipush/android_message.rb', line 22 def initialize(={}) @title = [:title] @description = [:description] @payload = [:payload] @pass_through = [:pass_through] || NTF_CENTER_NTF @notify_type = [:notify_type] || NOTIFY_TYPE_DEFAULT_SOUND @restricted_package_name = [:restricted_package_name] @secret_key = [:secret_key] end |
Instance Attribute Details
#enable_flow_controll ⇒ Object
Returns the value of attribute enable_flow_controll.
18 19 20 |
# File 'lib/mipush/android_message.rb', line 18 def enable_flow_controll @enable_flow_controll end |
#notify_id ⇒ Object
Returns the value of attribute notify_id.
18 19 20 |
# File 'lib/mipush/android_message.rb', line 18 def notify_id @notify_id end |
#notify_type ⇒ Object
Returns the value of attribute notify_type.
18 19 20 |
# File 'lib/mipush/android_message.rb', line 18 def notify_type @notify_type end |
#pass_through ⇒ Object
Returns the value of attribute pass_through.
18 19 20 |
# File 'lib/mipush/android_message.rb', line 18 def pass_through @pass_through end |
#payload ⇒ Object
Returns the value of attribute payload.
18 19 20 |
# File 'lib/mipush/android_message.rb', line 18 def payload @payload end |
#restricted_package_name ⇒ Object
Returns the value of attribute restricted_package_name.
18 19 20 |
# File 'lib/mipush/android_message.rb', line 18 def restricted_package_name @restricted_package_name end |
Instance Method Details
#to_params ⇒ Object
重构这一端烂代码
33 34 35 36 37 38 39 40 41 42 43 |
# 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 |