notifiable-sender 0.5.0 → 0.6.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: de83e365970e1c59cc5c5d4581b0bdb47285926d
|
4
|
+
data.tar.gz: f7c89b24d305dbe22f6b06c3119e302ac44325fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b170280090a2c800cf1925722a1b63299ef33208f29ac5dfdc77ba7b9cf7f207811c8382c7041d089f456c15b23a2594269b19f03eb36dc85db1659df01e966
|
7
|
+
data.tar.gz: d79e18ad8fffc195d3046f0fe43958083e6dddbea14d262fa0be81360db517cb459c1273353031474139471fa46d4f84897ca830ac487022112c35ce713d17d7
|
data/lib/notifiable/sender.rb
CHANGED
@@ -12,28 +12,30 @@ 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_notification_to_users(user_aliases, title: nil, message: nil, parameters: nil, content_available: nil)
|
15
|
+
def send_notification_to_users(user_aliases, title: nil, message: nil, parameters: nil, content_available: nil, thread_id: nil)
|
16
16
|
raise 'user_aliases should be an array' unless user_aliases.is_a? Array
|
17
17
|
|
18
18
|
filters = [{property: "user_alias", predicate: "in", value: user_aliases}]
|
19
|
-
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters)
|
19
|
+
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters, thread_id: thread_id)
|
20
20
|
end
|
21
21
|
|
22
|
-
def send_notification_to_user(user_alias, title: nil, message: nil, parameters: nil, content_available: nil)
|
22
|
+
def send_notification_to_user(user_alias, title: nil, message: nil, parameters: nil, content_available: nil, thread_id: nil)
|
23
23
|
filters = [{property: "user_alias", predicate: "eq", value: user_alias}]
|
24
|
-
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters)
|
24
|
+
send_notification(title: title, message: message, parameters: parameters, content_available: content_available, filters: filters, thread_id: thread_id)
|
25
25
|
end
|
26
26
|
|
27
27
|
#
|
28
28
|
# Params:
|
29
29
|
# - filters: An array of hashes to filter notifications, e.g. [{property: "alert_level", predicate: "lt", value: 3}]
|
30
|
-
def send_notification(title: nil, message: nil, parameters: nil, filters: nil, content_available: nil)
|
30
|
+
def send_notification(title: nil, message: nil, parameters: nil, filters: nil, content_available: nil, thread_id: nil)
|
31
31
|
body = {}
|
32
32
|
body[:title] = title unless title.nil?
|
33
33
|
body[:message] = message unless message.nil?
|
34
34
|
body[:parameters] = parameters.to_json unless parameters.nil?
|
35
35
|
body[:filters] = filters.to_json unless filters.nil?
|
36
36
|
body[:content_available] = content_available unless content_available.nil?
|
37
|
+
body[:thread_id] = thread_id unless thread_id.nil?
|
38
|
+
|
37
39
|
headers = {}
|
38
40
|
headers[:authorization] = @access_id unless @secret_key
|
39
41
|
@request = RestClient::Request.new url: "#{@base_uri}/api/v1/notifications", payload: {notification: body}, method: :post, headers: headers
|
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.6.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-06-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|