notifiable-sender 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/console +3 -3
- data/lib/notifiable/sender.rb +4 -4
- data/lib/notifiable/sender/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2958131d76cf0359f90f01a328e723fda012b6ca00b2bd96f378fa1ec8e252ed
|
4
|
+
data.tar.gz: 81ad219005c2d3c3e2d5269daeb192d8a2dfdd62db6e0a965490ec885b65f6a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed77aa960bd7d570898d37afe330094f0102464da94173248d39801aba324ea44fcb9489e10d8ddfef56b3403424a640ab104b560641e0077f1929015c4f7a0
|
7
|
+
data.tar.gz: 5f32ee28e8f7b4194d6ca0c7648fd8cf1c557ab84634966ae79217fac55eb1d033428a8e4c686a540f25dcc94f8657507f110d0600e494df82622f6d6fae5f91
|
data/bin/console
CHANGED
@@ -11,9 +11,9 @@ require "notifiable/sender"
|
|
11
11
|
# Pry.start
|
12
12
|
|
13
13
|
# convenience method
|
14
|
-
def send_notification(
|
15
|
-
sender = Notifiable::Sender.new
|
16
|
-
sender.
|
14
|
+
def send_notification(user_alias, message, base_uri = 'https://notifiable-staging.herokuapp.com', access_id = ENV['ACCESS_ID'], secret_key = ENV['SECRET_KEY'])
|
15
|
+
sender = Notifiable::Sender.new access_id, base_uri: base_uri, secret_key: secret_key
|
16
|
+
sender.send_notification_to_users([user_alias], message: message)
|
17
17
|
end
|
18
18
|
|
19
19
|
require "irb"
|
data/lib/notifiable/sender.rb
CHANGED
@@ -12,19 +12,19 @@ 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, expiry: 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, filters: [])
|
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
|
-
filters = [{property: "user_alias", predicate: "in", value: user_aliases}]
|
20
|
+
filters = filters + [{property: "user_alias", predicate: "in", value: user_aliases}]
|
21
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, expiry: 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, filters: [])
|
25
25
|
raise 'user_aliases should be an array' unless user_aliases.is_a? Array
|
26
26
|
|
27
|
-
filters = [{property: "user_alias", predicate: "in", value: user_aliases}]
|
27
|
+
filters = filters + [{property: "user_alias", predicate: "in", value: user_aliases}]
|
28
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
|
|
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.10.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-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.7.3
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Connect to Notifiable's notifications API.
|