class OneSignal::Notification
Attributes
attachments[R]
contents[R]
email_body[R]
email_subject[R]
excluded_segments[R]
headings[R]
included_segments[R]
included_targets[R]
send_after[R]
sounds[R]
template_id[R]
Public Class Methods
new(**params)
click to toggle source
# File lib/onesignal/notification.rb, line 12 def initialize **params unless params.include?(:contents) || params.include?(:template_id) raise ArgumentError, 'missing contents or template_id' end @contents = params[:contents] @headings = params[:headings] @template_id = params[:template_id] @included_segments = params[:included_segments] @excluded_segments = params[:excluded_segments] @included_targets = params[:included_targets] @email_subject = params[:email_subject] @email_body = params[:email_body] @send_after = params[:send_after].to_s @attachments = params[:attachments] @filters = params[:filters] @sounds = params[:sounds] @buttons = params[:buttons] end
Public Instance Methods
as_json(options = {})
click to toggle source
Calls superclass method
# File lib/onesignal/notification.rb, line 32 def as_json options = {} super(options) .except('attachments', 'sounds', 'included_targets') .merge(@attachments&.as_json(options) || {}) .merge(@sounds&.as_json(options) || {}) .merge(@buttons&.as_json(options) || {}) .merge(@included_targets&.as_json(options) || {}) .select { |_k, v| v.present? } end