Class: Xmpush::AndroidBuilder
- Defined in:
- lib/xmpush/android_builder.rb
Constant Summary collapse
- NOTIFY_TYPE_DEFAULT_ALL =
设置通知类型
-1
- NOTIFY_TYPE_DEFAULT_SOUND =
使用默认提示音提示
1
- NOTIFY_TYPE_DEFAULT_VIBRATE =
使用默认震动提示
2
- NOTIFY_TYPE_DEFAULT_LIGHTS =
使用默认led灯光提示
4
- NTF_CENTER_NTF =
通知栏消息
0
- PASS_THROUGH_NTF =
透传消息
1
Constants inherited from Message
Instance Attribute Summary collapse
-
#notify_id ⇒ Object
Returns the value of attribute notify_id.
-
#pass_through ⇒ Object
Returns the value of attribute pass_through.
-
#sound_url ⇒ Object
Returns the value of attribute sound_url.
Attributes inherited from Message
#description, #extra, #notify_type, #payload, #restricted_package_name, #time_to_live, #time_to_send, #title
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(**message) ⇒ AndroidBuilder
constructor
A new instance of AndroidBuilder.
Constructor Details
#initialize(**message) ⇒ AndroidBuilder
Returns a new instance of AndroidBuilder.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/xmpush/android_builder.rb', line 15 def initialize(**) super() extra = .delete(:extra) if [:extra] @pass_through = [:pass_through] || NTF_CENTER_NTF @notify_id = [:notify_id] || 0 @notify_type = [:notify_type] || NOTIFY_TYPE_DEFAULT_ALL = {sound_url: ""} .merge!(extra) if extra @extra = end |
Instance Attribute Details
#notify_id ⇒ Object
Returns the value of attribute notify_id.
13 14 15 |
# File 'lib/xmpush/android_builder.rb', line 13 def notify_id @notify_id end |
#pass_through ⇒ Object
Returns the value of attribute pass_through.
13 14 15 |
# File 'lib/xmpush/android_builder.rb', line 13 def pass_through @pass_through end |
#sound_url ⇒ Object
Returns the value of attribute sound_url.
13 14 15 |
# File 'lib/xmpush/android_builder.rb', line 13 def sound_url @sound_url end |
Instance Method Details
#build ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/xmpush/android_builder.rb', line 26 def build = extra(@extra) if @extra = { payload: @payload, title: @title, notify_id: @notify_id, pass_through: @pass_through, notify_type: @notify_type, restricted_package_name: @restricted_package_name, description: @description } .merge!() return end |