noticed 2.7.1 → 2.8.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: 4e9d45f1b942d7e3ad80d8fede7d76ab3b1c503d2e752508bf498e0779299a79
4
- data.tar.gz: ac97b350124abce45eb8d7a875fd99a1252769690b50e72335efdfdb76e19bb6
3
+ metadata.gz: afd30437fc53aab8cee21f63530ce41e5b349037b517679a3d0fae3e2c315c3e
4
+ data.tar.gz: 701eba3612bdddace5ec6421c16fe66290a6f591cfa91258c6bd2397c95a56e5
5
5
  SHA512:
6
- metadata.gz: 9cc04c25fad32bd8bfe44d231b0dc51c59f4f248d4125885def6867d158d18d33bd0389f69d6ced75ed8fb65096b43be22ed12ca6f1995e1d2a02860f2ce2bc5
7
- data.tar.gz: c5a3baa9b0f010f9d592e3fb42b185dad515595768a451763eab62954e987989e128b7d6b1fa27abe3ab5f2d362bb13e93d464b50f022d763d4cbd28bd16e183
6
+ metadata.gz: 0e44bf6d5ac832e7307314f5598ecf75abeafbc9049324361c8b57e12e565e9b096c49c02487c3bc1e50a2016a8c07e83239b79bff73af7a4e36870632c03455
7
+ data.tar.gz: 0afb4e395bd954663fd191b136456e5d79debb9af7595a6391a20930456d2760f9db274a8b0845713bb330ada1e7e0298905b07b8f379def4dcf6a2c2b671996
data/README.md CHANGED
@@ -4,9 +4,6 @@
4
4
 
5
5
  [![Build Status](https://github.com/excid3/noticed/workflows/Tests/badge.svg)](https://github.com/excid3/noticed/actions) [![Gem Version](https://badge.fury.io/rb/noticed.svg)](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:
@@ -594,7 +591,9 @@ You can mix and match the options and delivery methods to suit your application
594
591
 
595
592
  If you want to build your own delivery method to deliver notifications to a specific service or medium that Noticed doesn’t (or doesn’t _yet_) support, you’re welcome to do so! To generate a custom delivery method, simply run
596
593
 
597
- `rails generate noticed:delivery_method Discord`
594
+ ```bash
595
+ rails generate noticed:delivery_method Discord
596
+ ```
598
597
 
599
598
  This will generate a new `ApplicationDeliveryMethod` and `DeliveryMethods::Discord` class inside the `app/notifiers/delivery_methods` folder, which can be used to deliver notifications to Discord.
600
599
 
@@ -607,7 +606,6 @@ class DeliveryMethods::Discord < ApplicationDeliveryMethod
607
606
  # Logic for sending the notification
608
607
  end
609
608
  end
610
-
611
609
  ```
612
610
 
613
611
  You can use the custom delivery method thus created by adding a `deliver_by` line with a unique name and `class` option in your notification class.
@@ -618,6 +616,12 @@ class MyNotifier < Noticed::Event
618
616
  end
619
617
  ```
620
618
 
619
+ You can also generate bulk delivery methods with the `--bulk` flag:
620
+
621
+ ```bash
622
+ rails generate noticed:delivery_method Discord --bulk
623
+ ```
624
+
621
625
  <details>
622
626
  <summary>Turbo Stream Custom Delivery Method Example</summary>
623
627
 
@@ -11,9 +11,16 @@ module Noticed
11
11
 
12
12
  desc "Generates a class for a custom delivery method with the given NAME."
13
13
 
14
+ class_option :bulk, desc: "Generate as a bulk delivery method", type: :boolean, default: false
15
+
14
16
  def generate_notification
15
- template "application_delivery_method.rb", "app/notifiers/application_delivery_method.rb"
16
- template "delivery_method.rb", "app/notifiers/delivery_methods/#{singular_name}.rb"
17
+ if options[:bulk]
18
+ template "application_bulk_delivery_method.rb", "app/notifiers/application_bulk_delivery_method.rb"
19
+ template "bulk_delivery_method.rb", "app/notifiers/bulk_delivery_methods/#{singular_name}.rb"
20
+ else
21
+ template "application_delivery_method.rb", "app/notifiers/application_delivery_method.rb"
22
+ template "delivery_method.rb", "app/notifiers/delivery_methods/#{singular_name}.rb"
23
+ end
17
24
  end
18
25
  end
19
26
  end
@@ -0,0 +1,2 @@
1
+ class ApplicationBulkDeliveryMethod < Noticed::BulkDeliveryMethod
2
+ end
@@ -0,0 +1,14 @@
1
+ class BulkDeliveryMethods::<%= class_name %> < ApplicationBulkDeliveryMethod
2
+ # To use this delivery method, specify the class option in your notifier.
3
+ #
4
+ # class MyNotifer < ApplicationNotifier
5
+ # bulk_deliver_by :<%= file_path %>, class: "<%= class_name %>"
6
+ # end
7
+
8
+ # Specify required options for the deliver_by config block
9
+ # required_options :foo, :bar
10
+
11
+ def deliver
12
+ # Logic for sending the notification
13
+ end
14
+ end
@@ -1,6 +1,12 @@
1
1
  class DeliveryMethods::<%= class_name %> < ApplicationDeliveryMethod
2
- # Specify the config options your delivery method requires in its config block
3
- required_options # :foo, :bar
2
+ # To use this delivery method, specify the class option in your notifier.
3
+ #
4
+ # class MyNotifer < ApplicationNotifier
5
+ # deliver_by :<%= file_path %>, class: "<%= class_name %>"
6
+ # end
7
+
8
+ # Specify required options for the deliver_by config block
9
+ # required_options :foo, :bar
4
10
 
5
11
  def deliver
6
12
  # Logic for sending the notification
@@ -21,4 +21,10 @@ class <%= class_name %>Notifier < ApplicationNotifier
21
21
  # Add required params
22
22
  #
23
23
  # required_param :message
24
+
25
+ # Compute recipients without having to pass them in
26
+ #
27
+ # recipients do
28
+ # params[:record].thread.all_authors
29
+ # end
24
30
  end
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
- ActiveJob::Arguments.send(:serialize_argument, data)
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
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.7.1"
2
+ VERSION = "2.8.1"
3
3
  end
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.7.1
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -50,8 +50,10 @@ files:
50
50
  - lib/generators/noticed/install_generator.rb
51
51
  - lib/generators/noticed/notifier_generator.rb
52
52
  - lib/generators/noticed/templates/README
53
+ - lib/generators/noticed/templates/application_bulk_delivery_method.rb.tt
53
54
  - lib/generators/noticed/templates/application_delivery_method.rb.tt
54
55
  - lib/generators/noticed/templates/application_notifier.rb.tt
56
+ - lib/generators/noticed/templates/bulk_delivery_method.rb.tt
55
57
  - lib/generators/noticed/templates/delivery_method.rb.tt
56
58
  - lib/generators/noticed/templates/notifier.rb.tt
57
59
  - lib/noticed.rb