Class: JPush::Push::SinglePushPayload
- Inherits:
-
Object
- Object
- JPush::Push::SinglePushPayload
- Defined in:
- lib/jpush/push/single_push_payload.rb
Instance Method Summary collapse
-
#initialize(platform:, target:) ⇒ SinglePushPayload
constructor
A new instance of SinglePushPayload.
- #set_message(message) ⇒ Object
- #set_notification(notification) ⇒ Object
- #set_options(options) ⇒ Object
- #set_sms_message(sms_message) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(platform:, target:) ⇒ SinglePushPayload
Returns a new instance of SinglePushPayload.
7 8 9 10 |
# File 'lib/jpush/push/single_push_payload.rb', line 7 def initialize(platform: , target: ) @platform = 'all' == platform ? 'all' : build_platform(platform) @target = target end |
Instance Method Details
#set_message(message) ⇒ Object
17 18 19 20 |
# File 'lib/jpush/push/single_push_payload.rb', line 17 def () @message = self end |
#set_notification(notification) ⇒ Object
12 13 14 15 |
# File 'lib/jpush/push/single_push_payload.rb', line 12 def set_notification(notification) @notification = notification self end |
#set_options(options) ⇒ Object
27 28 29 30 |
# File 'lib/jpush/push/single_push_payload.rb', line 27 def () @options = self end |
#set_sms_message(sms_message) ⇒ Object
22 23 24 25 |
# File 'lib/jpush/push/single_push_payload.rb', line 22 def () @sms_message = self end |
#to_hash ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jpush/push/single_push_payload.rb', line 32 def to_hash single_push_payload = { platform: @platform, target: @target, notification: @notification, message: @message, sms_message: @sms_message, options: @options }.select { |_, value| !value.nil? } end |