unotifier 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -3
- data/lib/settings.rb +22 -3
- data/lib/unotifier/version.rb +1 -1
- data/lib/unotifier.rb +5 -3
- data/unotifier.gemspec +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e36c94a2ad43b15907fd815bdd1cbcf1ac57ccbaa74669a0679c047cad57cd7
|
4
|
+
data.tar.gz: 1f8b421d296c6cecd822a0dffa3570d7da90258e01ba1e8d17d8a01575c3a40e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 849372e46b95eabf123e16a3be07a61b9b99842defaad61779294df947a89a09ee57b902efe1aab3f1af6e7d6a2b35a8251b25808b517de3cd56639db2ec8ab5
|
7
|
+
data.tar.gz: cac003f129456229908890a3bb42e8a0b29910ad7e2f36933c8ff64997d8c09fc9ff6170103f8c20da5944d56328879fe8b723966181a737179dc8b982bca399
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# UNotifier
|
2
2
|
|
3
|
-
[](https://travis-ci.com/mgpnd/unotifier)
|
4
|
-
|
5
3
|
## Installation
|
6
4
|
|
7
5
|
Add this line to your application's Gemfile:
|
@@ -37,7 +35,7 @@ To store your notifications in database UNotifier uses provided ActiveRecord mod
|
|
37
35
|
|
38
36
|
## Contributing
|
39
37
|
|
40
|
-
Bug reports and pull requests are welcome on
|
38
|
+
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/hodlhodl/unotifier.
|
41
39
|
|
42
40
|
## License
|
43
41
|
|
data/lib/settings.rb
CHANGED
@@ -13,18 +13,37 @@ module UNotifier
|
|
13
13
|
(value.has_key?("target") && value["target"].values.any? { |subvalue| customizable?(subvalue) })
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
filtered = filtered.each_with_object({}) do |(subkey, value), out|
|
17
|
+
out[subkey] = value["urgency"] ||
|
18
|
+
value["target"]
|
19
|
+
.select { |_, subvalue| customizable?(subvalue) }
|
20
|
+
.map { |_, subvalue| subvalue["urgency"] }
|
21
|
+
.first
|
22
|
+
end
|
23
|
+
|
24
|
+
[key, filtered]
|
25
|
+
end.to_h.select { |_, subkeys| !subkeys.empty? }
|
18
26
|
end
|
19
27
|
|
20
28
|
def self.keys_from(config)
|
21
29
|
flatten_keys filter_customizable(config)
|
22
30
|
end
|
23
31
|
|
32
|
+
def self.grouped_by_urgency_keys_from(config)
|
33
|
+
keys_from(config).each_with_object({}) do |(key, urgency), out|
|
34
|
+
out[urgency] ||= []
|
35
|
+
out[urgency] << key
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
24
39
|
private
|
25
40
|
|
26
41
|
def self.flatten_keys(keys)
|
27
|
-
keys.map
|
42
|
+
keys.map do |key, subkeys|
|
43
|
+
subkeys.map do |subkey, urgency|
|
44
|
+
{ "#{key}.#{subkey}" => urgency }
|
45
|
+
end
|
46
|
+
end.flatten.reduce({}, :merge)
|
28
47
|
end
|
29
48
|
end
|
30
49
|
end
|
data/lib/unotifier/version.rb
CHANGED
data/lib/unotifier.rb
CHANGED
@@ -100,9 +100,11 @@ module UNotifier
|
|
100
100
|
def self.notification_settings_for(target)
|
101
101
|
user_settings = target.notification_settings
|
102
102
|
Settings
|
103
|
-
.
|
104
|
-
.each_with_object({}) do |
|
105
|
-
settings[
|
103
|
+
.grouped_by_urgency_keys_from(notifications_config)
|
104
|
+
.each_with_object({}) do |(urgency, keys), settings|
|
105
|
+
settings[urgency] = keys.each_with_object({}) do |(key, _), out|
|
106
|
+
out[key] = user_settings[key] || Settings::DEFAULT_URGENCY
|
107
|
+
end
|
106
108
|
end
|
107
109
|
end
|
108
110
|
|
data/unotifier.gemspec
CHANGED
@@ -10,12 +10,12 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["stillintop@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = "Ultimate user notification tool for web apps"
|
13
|
-
spec.homepage = "https://
|
13
|
+
spec.homepage = "https://gitlab.com/hodlhodl/unotifier"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
if spec.respond_to?(:metadata)
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["sourc_code_uri"] = "https://
|
18
|
+
spec.metadata["sourc_code_uri"] = "https://gitlab.com/hodlhodl/unotifier"
|
19
19
|
else
|
20
20
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
21
|
"public gem pushes."
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
26
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) || f.match(%r{
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) || f.match(%r{^\.rspec}) }
|
28
28
|
end
|
29
29
|
spec.bindir = "bin"
|
30
30
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unotifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Rashev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,12 +124,12 @@ files:
|
|
124
124
|
- lib/unotifier.rb
|
125
125
|
- lib/unotifier/version.rb
|
126
126
|
- unotifier.gemspec
|
127
|
-
homepage: https://
|
127
|
+
homepage: https://gitlab.com/hodlhodl/unotifier
|
128
128
|
licenses:
|
129
129
|
- MIT
|
130
130
|
metadata:
|
131
|
-
homepage_uri: https://
|
132
|
-
sourc_code_uri: https://
|
131
|
+
homepage_uri: https://gitlab.com/hodlhodl/unotifier
|
132
|
+
sourc_code_uri: https://gitlab.com/hodlhodl/unotifier
|
133
133
|
post_install_message:
|
134
134
|
rdoc_options: []
|
135
135
|
require_paths:
|