class JPush::Push::Notification
Public Instance Methods
set_alert(alert)
click to toggle source
# File lib/jpush/push/notification.rb, line 5 def set_alert(alert) @alert = alert self end
set_android(alert: , title: nil, builder_id: nil, channel_id: nil, priority: nil, category: nil, style: nil, alert_type: nil, big_text: nil, inbox: nil, big_pic_path: nil, extras: nil, large_icon: nil, intent: nil)
click to toggle source
# File lib/jpush/push/notification.rb, line 15 def set_android(alert: , title: nil, builder_id: nil, channel_id: nil, priority: nil, category: nil, style: nil, alert_type: nil, big_text: nil, inbox: nil, big_pic_path: nil, extras: nil, large_icon: nil, intent: nil) @android = { alert: alert, title: title, builder_id: builder_id, channel_id: channel_id, priority: priority, category: category, style: style, alert_type: alert_type, big_text: big_text, inbox: inbox, big_pic_path: big_pic_path, extras: extras, large_icon: large_icon, intent: intent }.select { |_, value| !value.nil? } self end
set_ios(alert: , sound: nil, badge: '+1', available: nil, category:nil, extras: nil, contentavailable: nil, mutablecontent: nil, thread: nil)
click to toggle source
# File lib/jpush/push/notification.rb, line 37 def set_ios(alert: , sound: nil, badge: '+1', available: nil, category:nil, extras: nil, contentavailable: nil, mutablecontent: nil, thread: nil) contentavailable = available if contentavailable.nil? contentavailable = nil unless contentavailable.is_a? TrueClass mutablecontent = nil unless mutablecontent.is_a? TrueClass @ios = { alert: alert, sound: sound, badge: badge, 'content-available': contentavailable, 'mutable-content': mutablecontent, category: category, extras: extras, 'thread-id': thread }.select { |_, value| !value.nil? } self end
set_not_alert()
click to toggle source
# File lib/jpush/push/notification.rb, line 10 def set_not_alert @alert = '' self end
to_hash()
click to toggle source
# File lib/jpush/push/notification.rb, line 54 def to_hash @notification = { alert: @alert, android: @android, ios: @ios }.select { |_, value| !value.nil? } raise Utils::Exceptions::JPushError, 'Notification can not be empty.' if @notification.empty? @notification end