lib/notifiable/sender.rb in notifiable-sender-0.3.3 vs lib/notifiable/sender.rb in notifiable-sender-0.4.0
- old
+ new
@@ -10,14 +10,23 @@
raise 'access_id cannot be nil' if !access_id || access_id.empty?
@base_uri, @access_id, @secret_key, @logger = base_uri, access_id, secret_key, logger
end
+ def send_notification_to_users(user_aliases, title: nil, message: nil, parameters: nil, content_available: nil)
+ raise 'user_aliases should be Enumerable' unless user_aliases.is_a? Enumerable
+
+ user_aliases.each {|user_alias| send_notification_to_user(user_alias, title, message, parameters, content_avaiable)}
+ end
+
def send_notification_to_user(user_alias, title: nil, message: nil, parameters: nil, content_available: nil)
filters = [{property: "user_alias", predicate: "eq", value: user_alias}]
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters)
end
+ #
+ # Params:
+ # - filters: An array of hashes to filter notifications, e.g. [{property: "alert_level", predicate: "lt", value: 3}]
def send_notification(title: nil, message: nil, parameters: nil, filters: nil, content_available: nil)
body = {}
body[:title] = title unless title.nil?
body[:message] = message unless message.nil?
body[:parameters] = parameters.to_json unless parameters.nil?