Class: Xiaomi::Push::Message::IOS

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

Overview

iOS 数据消息体

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) ⇒ IOS

Returns a new instance of IOS.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/xiaomi/push/services/messages/ios.rb', line 18

def initialize(**params)
  @title = params[:title]
  @subtitle = params[:subtitle]
  @description = params[:description]
  @body = params[:body] || @description

  @image = params[:image]
  @mutable_content = params[:mutable_content]
  @mutable_content = 1 if @image

  @badge = params[:badge] || 1
  @sound = params[:sound] || 'default'
  @category = params[:category]
  @extras = params[:extras] || {}
end

Instance Attribute Details

#badgeInteger

角标, 默认 1

Returns:

  • (Integer)

    the current value of badge



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def badge
  @badge
end

#bodyString

描述(仅适用于 iOS 10 以上设备)

Returns:

  • (String)

    the current value of body



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def body
  @body
end

#categoryString

iOS 8 以上可设置推送消息快速回复类别

Returns:

  • (String)

    the current value of category



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def category
  @category
end

#descriptionString

描述(如果设置了 title 或 subtitle 将会启用变为 #body

Returns:

  • (String)

    the current value of description



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def description
  @description
end

#imageString

图片地址(仅适用于 iOS 10 以上设备,填写后自动启用 mutable_content)

Returns:

  • (String)

    the current value of image



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def image
  @image
end

#mutable_contentInteger

可变内容,默认 nil 不启用

Returns:

  • (Integer)

    the current value of mutable_content



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def mutable_content
  @mutable_content
end

#soundString

声音,默认 default

Returns:

  • (String)

    the current value of sound



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def sound
  @sound
end

#subtitleString

副标题(仅适用于 iOS 10 以上设备)

Returns:

  • (String)

    the current value of subtitle



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def subtitle
  @subtitle
end

#titleString

标题(仅适用于 iOS 10 以上设备)

Returns:

  • (String)

    the current value of title



14
15
16
# File 'lib/xiaomi/push/services/messages/ios.rb', line 14

def title
  @title
end