Class: Xiaomi::Push::Message::Android

Inherits:
Base
  • Object
show all
Defined in:
lib/xiaomi/push/services/messages/android.rb

Overview

Android 消息数据体

Instance Attribute Summary collapse

Attributes inherited from Base

#alias, #extras, #registration_id, #topic, #topic_op, #topics, #user_account

Instance Method Summary collapse

Methods inherited from Base

#android?, #current, #extra, #ios10_struct, #ios10_struct?, #ios?, #to_params, #type

Constructor Details

#initialize(**params) ⇒ Android

Returns a new instance of Android.



16
17
18
19
20
21
22
23
24
25
# File 'lib/xiaomi/push/services/messages/android.rb', line 16

def initialize(**params)
  @title = params[:title]
  @description = params[:description]
  @badge = params[:badge] || 1
  @sound = params[:sound] || 'default'
  @pass_through = params[:pass_through] || 0
  @notify_type = params[:notify_type] || 'DEFAULT_ALL'
  @notify_id = params[:notify_id]
  @extras = params[:extras] || {}
end

Instance Attribute Details

#badgeString

角标, 默认 1

Returns:

  • (String)

    the current value of badge



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def badge
  @badge
end

#descriptionString

描述

Returns:

  • (String)

    the current value of description



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def description
  @description
end

#notify_idInteger

提醒,默认情况下,通知栏只显示一条推送消息。如果通知栏要显示多条推送消息,需要针对不同的消息设置不同的 notify_id

Returns:

  • (Integer)

    the current value of notify_id



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def notify_id
  @notify_id
end

#notify_typeString

提醒类型,取值 DEFAULT_ALL(默认)/DEFAULT_SOUND(提示音)/DEFAULT_VIBRATE(振动)/DEFAULT_LIGHTS(指示灯)

Returns:

  • (String)

    the current value of notify_type



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def notify_type
  @notify_type
end

#pass_throughString

是否为穿透, 取值 0(默认,通知栏消息)/1(穿透)

Returns:

  • (String)

    the current value of pass_through



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def pass_through
  @pass_through
end

#soundString

声音,默认 default

Returns:

  • (String)

    the current value of sound



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def sound
  @sound
end

#titleString

标题

Returns:

  • (String)

    the current value of title



13
14
15
# File 'lib/xiaomi/push/services/messages/android.rb', line 13

def title
  @title
end