unotifier 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab124f207e21102d80111f02fca618367788bb09e0c3a4565fd9aa74087253e7
4
- data.tar.gz: 06b4f14f4252785d1e41a1d79ed754f7c939d6449f33717343f1b1515ee5be99
3
+ metadata.gz: 0ed6bbfeff3bef2d52c7595a47b48858fc22e09e212ddebce377a2330140936c
4
+ data.tar.gz: 875927c0296145d3b1c3a0ac2da3c2db85173efd2784607993abb2a7fac9456f
5
5
  SHA512:
6
- metadata.gz: a441acebc93d75306f68dc241184891d17908c6737c535a2c18f089885814d9ccedc40db76319c0ab7d1e854f2f70e100bff1be9e3a5fe73bf147d91cd3d8d73
7
- data.tar.gz: '094405411bf9a32bfde02c00de440c1ffff31c2d051c76c5404688a6395a00f646a613623633a4737573ed8c0e1ab2d7ef52f7d08e6ed46638009d7bf37bf297'
6
+ metadata.gz: 6ae210ee39d61e74bad88908a5e9f662f73b73356c5607e80c6869da4f8c82339526887f8411b368c1cc831af4fd4f77965353ad71176628b9b8f88be9fee235
7
+ data.tar.gz: 2949be7620780143fbcdbb04957dc70fdfcf63bb37bfb09b84d5cf1b69e7e367a29df3488eb258dc4827ed811d4bf69019633f85e3831ff8b38ae2cb582b78b6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unotifier (0.2.0)
4
+ unotifier (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/settings.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module UNotifier
2
2
  class Settings
3
+ DEFAULT_URGENCY = "external"
4
+
3
5
  def self.customizable?(config)
4
6
  %w(regular optional).include?(config["urgency"])
5
7
  end
@@ -1,3 +1,3 @@
1
1
  module UNotifier
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/unotifier.rb CHANGED
@@ -68,7 +68,7 @@ module UNotifier
68
68
 
69
69
  def self.notify(key, target, params = {})
70
70
  user_settings = target.notification_settings[key]
71
- user_settings ||= "external"
71
+ user_settings ||= Settings::DEFAULT_URGENCY
72
72
  locale_key = locale_key_for(key, params)
73
73
  urgency = urgency_for(key, params)
74
74
 
@@ -97,6 +97,15 @@ module UNotifier
97
97
  notify(key, target, params.merge(external_only: true))
98
98
  end
99
99
 
100
+ def self.notification_settings_for(target)
101
+ user_settings = target.notification_settings
102
+ Settings
103
+ .keys_from(notifications_config)
104
+ .each_with_object({}) do |key, settings|
105
+ settings[key] = user_settings[key] || Settings::DEFAULT_URGENCY
106
+ end
107
+ end
108
+
100
109
  private
101
110
 
102
111
  def self.notify_onsite?(notification, user_settings)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unotifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Rashev