noticed 2.4.1 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d2028c8acaa806c4ce94491efc21e4cef94756bed16fbcb6ac26d03844d8965
4
- data.tar.gz: 7b8842063ae43ec9bc9ea1630c912c6529546c3ece674b5f61a55d066a331de5
3
+ metadata.gz: 677a6b78d1143ff969b760036c8e65f0bce31634d5c7266dcc349d578d95fca9
4
+ data.tar.gz: d4324a075d591bce40142e00238e7569204ff992f873751d87996ea58c9c5dea
5
5
  SHA512:
6
- metadata.gz: 335ae225976b95869a72ba274a37000279161045826afcce6f966e3ef7fd42bfaf94acc754667823ea3ec5f0ac526b2b67f9244ce79c6dd20a8e7e7b7c9193b6
7
- data.tar.gz: 1aef782254a0421f905519871b5c553d0b3ae85c119347016a9b0805f8af6c349105991bf0ace186bb71349a6f767f22ff4a46a08765b46df17c7c5aa60fd942
6
+ metadata.gz: f67c84d09542ac5aead58374c887cb7819e4d51764789a58236a942b820d10df87576a24ed643f2ec93d8df511f7d5cffe8587232248a22c0d7dfdf2cc998206
7
+ data.tar.gz: 47a50d36007c73123e198fcb3b12e14765a5939d6f987a2394a78428d3f50ffaab56a33bb2da67436885e92a8cf86242d7c956e7482b1aef892b00c9ec972aa6
data/README.md CHANGED
@@ -341,7 +341,7 @@ If you want to reuse delivery method configurations across multiple Notifiers, y
341
341
  # /app/notifiers/notifiers/comment_notifier.rb
342
342
  class CommentNotifier < Noticed::Event
343
343
  include IosNotifier
344
- include AndriodNotifer
344
+ include AndroidNotifier
345
345
  include EmailNotifier
346
346
 
347
347
  validates :record, presence: true
@@ -399,6 +399,34 @@ This invocation will create a single `Noticed::Event` record and a `Noticed::Not
399
399
  - An individual delivery job for `:email` method to the second thread author
400
400
  - Etc...
401
401
 
402
+ #### Tip: Define recipients inside the notifier
403
+
404
+ Recipients can also be computed inside a notifier:
405
+
406
+ ```ruby
407
+ class NewCommentNotifier < ApplicationNotifier
408
+ recipients ->{ params[:record].thread.all_authors }
409
+
410
+ # or
411
+ recipients do
412
+ params[:record].thread.all_authors
413
+ end
414
+
415
+ # or
416
+ recipients :fetch_recipients
417
+
418
+ def fetch_recipients
419
+ # ...
420
+ end
421
+ end
422
+ ```
423
+
424
+ This makes the code for sending a notification neater:
425
+
426
+ ```ruby
427
+ NewCommentNotifier.with(record: @comment, foo: "bar").deliver
428
+ ```
429
+
402
430
  ### Custom Noticed Model Methods
403
431
 
404
432
  In order to extend the Noticed models you'll need to use a concern and a to_prepare block:
@@ -1,7 +1,5 @@
1
1
  module Noticed
2
- class EventJob < ApplicationJob
3
- queue_as :default
4
-
2
+ class EventJob < Noticed.parent_class.constantize
5
3
  def perform(event)
6
4
  # Enqueue bulk deliveries
7
5
  event.bulk_delivery_methods.each_value do |deliver_by|
@@ -10,6 +10,7 @@ module Noticed
10
10
  class Notification
11
11
  include ActiveModel::Model
12
12
  include ActiveModel::Attributes
13
+ include Noticed::Translation
13
14
 
14
15
  attribute :recipient
15
16
  attribute :event
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.4.1"
2
+ VERSION = "2.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noticed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.5.15
103
+ rubygems_version: 3.5.17
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Notifications for Ruby on Rails applications