noticed 2.8.0 → 2.9.0
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/README.md +0 -3
- data/lib/generators/noticed/templates/bulk_delivery_method.rb.tt +2 -2
- data/lib/generators/noticed/templates/delivery_method.rb.tt +2 -2
- data/lib/noticed/api_client.rb +2 -0
- data/lib/noticed/bulk_delivery_methods/webhook.rb +2 -1
- data/lib/noticed/coder.rb +5 -1
- data/lib/noticed/delivery_methods/action_push_native.rb +24 -0
- data/lib/noticed/delivery_methods/webhook.rb +2 -1
- data/lib/noticed/engine.rb +4 -0
- data/lib/noticed/version.rb +1 -1
- data/lib/noticed.rb +8 -31
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20ca096170ce0f9fa8fd0e52cae0546de54f044ebfeef249e72244208a4b75e0
|
4
|
+
data.tar.gz: 42c580d5326bb34b7c9624d904a35a1009b1880d901e8a585b16303495918c4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 804c185cf057a92f6d8745c24131819ef2fa41bb2098ff277a70f9de14b4096650f4de88b50d571c1f6f83105017760c711fe54853cdf1bfd8b786d9de7074b3
|
7
|
+
data.tar.gz: c1a845920409b634c596a8e8a38ca5f475b76000418e066feb196e511fe055ddae9abf4cac2bdf52594afa741417ad64eaf57d2a0e834bd011f9298ef72b2bbc
|
data/README.md
CHANGED
@@ -4,9 +4,6 @@
|
|
4
4
|
|
5
5
|
[](https://github.com/excid3/noticed/actions) [](https://badge.fury.io/rb/noticed)
|
6
6
|
|
7
|
-
> [!IMPORTANT]
|
8
|
-
> **⚠️ Upgrading from V1? Read the [Upgrade Guide](https://github.com/excid3/noticed/blob/main/UPGRADE.md)!**
|
9
|
-
|
10
7
|
Noticed is a gem that allows your application to send notifications of varying types, over various mediums, to various recipients. Be it a Slack notification to your own team when some internal event occurs or a notification to your user, sent as a text message, email, and real-time UI element in the browser, Noticed supports all of the above (at the same time)!
|
11
8
|
|
12
9
|
Noticed implements two top-level types of delivery methods:
|
@@ -5,8 +5,8 @@ class BulkDeliveryMethods::<%= class_name %> < ApplicationBulkDeliveryMethod
|
|
5
5
|
# bulk_deliver_by :<%= file_path %>, class: "<%= class_name %>"
|
6
6
|
# end
|
7
7
|
|
8
|
-
# Specify
|
9
|
-
required_options
|
8
|
+
# Specify required options for the deliver_by config block
|
9
|
+
# required_options :foo, :bar
|
10
10
|
|
11
11
|
def deliver
|
12
12
|
# Logic for sending the notification
|
@@ -5,8 +5,8 @@ class DeliveryMethods::<%= class_name %> < ApplicationDeliveryMethod
|
|
5
5
|
# deliver_by :<%= file_path %>, class: "<%= class_name %>"
|
6
6
|
# end
|
7
7
|
|
8
|
-
# Specify
|
9
|
-
required_options
|
8
|
+
# Specify required options for the deliver_by config block
|
9
|
+
# required_options :foo, :bar
|
10
10
|
|
11
11
|
def deliver
|
12
12
|
# Logic for sending the notification
|
data/lib/noticed/api_client.rb
CHANGED
data/lib/noticed/coder.rb
CHANGED
@@ -11,7 +11,11 @@ module Noticed
|
|
11
11
|
|
12
12
|
def self.dump(data)
|
13
13
|
return if data.nil?
|
14
|
-
|
14
|
+
if Rails.gem_version >= Gem::Version.new("8.1.0.beta1")
|
15
|
+
ActiveJob::Arguments.serialize(data)
|
16
|
+
else
|
17
|
+
ActiveJob::Arguments.send(:serialize_argument, data)
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Noticed
|
2
|
+
module DeliveryMethods
|
3
|
+
class ActionPushNative < DeliveryMethod
|
4
|
+
required_options :devices, :format
|
5
|
+
|
6
|
+
def deliver
|
7
|
+
notification = evaluate_option(:silent) ? notification_class : notification_class.silent
|
8
|
+
|
9
|
+
notification
|
10
|
+
.with_apple(evaluate_option(:with_apple))
|
11
|
+
.with_google(evaluate_option(:with_google))
|
12
|
+
.with_data(evaluate_option(:with_data))
|
13
|
+
.new(**evaluate_option(:format))
|
14
|
+
.deliver_later_to(evaluate_option(:devices))
|
15
|
+
end
|
16
|
+
|
17
|
+
def notification_class
|
18
|
+
fetch_constant(:class) || ApplicationPushNotification
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
ActiveSupport.run_load_hooks :noticed_delivery_methods_action_push_native, Noticed::DeliveryMethods::ActionPushNative
|
data/lib/noticed/engine.rb
CHANGED
@@ -2,6 +2,10 @@ module Noticed
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace Noticed
|
4
4
|
|
5
|
+
initializer "noticed.deprecator" do |app|
|
6
|
+
app.deprecators[:noticed] = Noticed.deprecator if app.respond_to?(:deprecators)
|
7
|
+
end
|
8
|
+
|
5
9
|
initializer "noticed.has_notifications" do
|
6
10
|
ActiveSupport.on_load(:active_record) do
|
7
11
|
include Noticed::HasNotifications
|
data/lib/noticed/version.rb
CHANGED
data/lib/noticed.rb
CHANGED
@@ -1,53 +1,30 @@
|
|
1
1
|
require "noticed/version"
|
2
2
|
require "noticed/engine"
|
3
3
|
|
4
|
+
require "zeitwerk"
|
5
|
+
|
6
|
+
loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
7
|
+
loader.ignore("#{__dir__}/generators")
|
8
|
+
loader.setup
|
9
|
+
|
4
10
|
module Noticed
|
5
11
|
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
6
12
|
|
7
13
|
def self.deprecator # :nodoc:
|
8
|
-
@deprecator ||= ActiveSupport::Deprecation.new
|
14
|
+
@deprecator ||= ActiveSupport::Deprecation.new("3.0", "Noticed")
|
9
15
|
end
|
10
16
|
|
11
17
|
deprecate_constant :Base, "Noticed::Event", deprecator: deprecator
|
12
18
|
|
13
|
-
autoload :ApiClient, "noticed/api_client"
|
14
|
-
autoload :BulkDeliveryMethod, "noticed/bulk_delivery_method"
|
15
|
-
autoload :Coder, "noticed/coder"
|
16
|
-
autoload :DeliveryMethod, "noticed/delivery_method"
|
17
|
-
autoload :HasNotifications, "noticed/has_notifications"
|
18
|
-
autoload :NotificationChannel, "noticed/notification_channel"
|
19
|
-
autoload :RequiredOptions, "noticed/required_options"
|
20
|
-
autoload :Translation, "noticed/translation"
|
21
|
-
|
22
|
-
module BulkDeliveryMethods
|
23
|
-
autoload :Bluesky, "noticed/bulk_delivery_methods/bluesky"
|
24
|
-
autoload :Discord, "noticed/bulk_delivery_methods/discord"
|
25
|
-
autoload :Slack, "noticed/bulk_delivery_methods/slack"
|
26
|
-
autoload :Test, "noticed/bulk_delivery_methods/test"
|
27
|
-
autoload :Webhook, "noticed/bulk_delivery_methods/webhook"
|
28
|
-
end
|
29
|
-
|
30
19
|
module DeliveryMethods
|
31
20
|
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
32
21
|
deprecate_constant :Base, "Noticed::DeliveryMethod", deprecator: Noticed.deprecator
|
33
|
-
|
34
|
-
autoload :ActionCable, "noticed/delivery_methods/action_cable"
|
35
|
-
autoload :Email, "noticed/delivery_methods/email"
|
36
|
-
autoload :Fcm, "noticed/delivery_methods/fcm"
|
37
|
-
autoload :Ios, "noticed/delivery_methods/ios"
|
38
|
-
autoload :MicrosoftTeams, "noticed/delivery_methods/microsoft_teams"
|
39
|
-
autoload :Slack, "noticed/delivery_methods/slack"
|
40
|
-
autoload :Test, "noticed/delivery_methods/test"
|
41
|
-
autoload :TwilioMessaging, "noticed/delivery_methods/twilio_messaging"
|
42
|
-
autoload :VonageSms, "noticed/delivery_methods/vonage_sms"
|
43
|
-
autoload :Webhook, "noticed/delivery_methods/webhook"
|
44
22
|
end
|
45
23
|
|
46
24
|
mattr_accessor :parent_class
|
47
25
|
@@parent_class = "Noticed::ApplicationJob"
|
48
26
|
|
49
|
-
class ValidationError < StandardError
|
50
|
-
end
|
27
|
+
class ValidationError < StandardError; end
|
51
28
|
|
52
29
|
class ResponseUnsuccessful < StandardError
|
53
30
|
attr_reader :response
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noticed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/noticed/coder.rb
|
68
68
|
- lib/noticed/delivery_method.rb
|
69
69
|
- lib/noticed/delivery_methods/action_cable.rb
|
70
|
+
- lib/noticed/delivery_methods/action_push_native.rb
|
70
71
|
- lib/noticed/delivery_methods/discord.rb
|
71
72
|
- lib/noticed/delivery_methods/email.rb
|
72
73
|
- lib/noticed/delivery_methods/fcm.rb
|
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '0'
|
103
104
|
requirements: []
|
104
|
-
rubygems_version: 3.7.
|
105
|
+
rubygems_version: 3.7.2
|
105
106
|
specification_version: 4
|
106
107
|
summary: Notifications for Ruby on Rails applications
|
107
108
|
test_files: []
|