notifiable-sender 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/notifiable/sender.rb +7 -5
- data/lib/notifiable/sender/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 271399b655fc31671cf3caf10c9cde66f1b9df9a
|
4
|
+
data.tar.gz: 75ddbd8f4cc8a5f42aeba8a70367e98b23ac246a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e5c89e80759b05a2d1d272e69e69f28ba86fbafc2098e05742a4668357891e3e87328ffd9b69d50db5b40e2ea94104704f95f84496feb3a33bca7d208bda078
|
7
|
+
data.tar.gz: 8e0103ccb6b2a1404975a1488005d18d434bc0c1b1c6582bc33f12e37fc0eeb1309d0833745653fdb78ffd6421281f45049a48fcee3ce95efbab4eb662d861ad
|
data/lib/notifiable/sender.rb
CHANGED
@@ -12,26 +12,27 @@ module Notifiable
|
|
12
12
|
@base_uri, @access_id, @secret_key, @logger = base_uri, access_id, secret_key, logger
|
13
13
|
end
|
14
14
|
|
15
|
-
def send_media_notification_to_users(user_aliases, media_url, title: nil, message: nil, parameters: {}, content_available: nil, thread_id: nil, category: nil)
|
15
|
+
def send_media_notification_to_users(user_aliases, media_url, title: nil, message: nil, parameters: {}, content_available: nil, thread_id: nil, category: nil, expiry: nil)
|
16
16
|
raise 'user_aliases should be an array' unless user_aliases.is_a? Array
|
17
17
|
raise 'media_url should not be blank' if media_url.nil? || media_url.empty?
|
18
18
|
|
19
19
|
parameters = {media_url: media_url}.merge(parameters)
|
20
20
|
filters = [{property: "user_alias", predicate: "in", value: user_aliases}]
|
21
|
-
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters, thread_id: thread_id, mutable_content: true, category: category)
|
21
|
+
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters, thread_id: thread_id, mutable_content: true, category: category, expiry: expiry)
|
22
22
|
end
|
23
23
|
|
24
|
-
def send_notification_to_users(user_aliases, title: nil, message: nil, parameters: nil, content_available: nil, thread_id: nil, mutable_content: nil, category: nil)
|
24
|
+
def send_notification_to_users(user_aliases, title: nil, message: nil, parameters: nil, content_available: nil, thread_id: nil, mutable_content: nil, category: nil, expiry: nil)
|
25
25
|
raise 'user_aliases should be an array' unless user_aliases.is_a? Array
|
26
26
|
|
27
27
|
filters = [{property: "user_alias", predicate: "in", value: user_aliases}]
|
28
|
-
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters, thread_id: thread_id, mutable_content: mutable_content, category: category)
|
28
|
+
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters, thread_id: thread_id, mutable_content: mutable_content, category: category, expiry: expiry)
|
29
29
|
end
|
30
30
|
|
31
31
|
#
|
32
32
|
# Params:
|
33
33
|
# - filters: An array of hashes to filter notifications, e.g. [{property: "alert_level", predicate: "lt", value: 3}]
|
34
|
-
|
34
|
+
# - expiry: The system will not retry delivery past this date.
|
35
|
+
def send_notification(title: nil, message: nil, parameters: nil, filters: nil, content_available: nil, thread_id: nil, mutable_content: nil, category: nil, expiry: nil)
|
35
36
|
body = {}
|
36
37
|
body[:title] = title unless title.nil?
|
37
38
|
body[:message] = message unless message.nil?
|
@@ -41,6 +42,7 @@ module Notifiable
|
|
41
42
|
body[:thread_id] = thread_id unless thread_id.nil?
|
42
43
|
body[:mutable_content] = mutable_content unless mutable_content.nil?
|
43
44
|
body[:category] = category unless category.nil?
|
45
|
+
body[:expiry] = expiry unless expiry.nil?
|
44
46
|
|
45
47
|
headers = {}
|
46
48
|
headers[:authorization] = @access_id unless @secret_key
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-sender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|