noticed 2.7.0 → 2.7.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: 409bc0222c2ca902d1cf99a7015cfe24ca3f0c9b1e765ff97af2ae327ce8598f
4
- data.tar.gz: 022f80d4007f6026d874cf1ba68898028e294989d84204db476c53864ffd43aa
3
+ metadata.gz: 4e9d45f1b942d7e3ad80d8fede7d76ab3b1c503d2e752508bf498e0779299a79
4
+ data.tar.gz: ac97b350124abce45eb8d7a875fd99a1252769690b50e72335efdfdb76e19bb6
5
5
  SHA512:
6
- metadata.gz: 7229791c39a6edb4ae4abff40a8bbbb6f727167235714b1b8ecaab2769ab9770771059ddccbe1f8f8372ac233ad2cb6ca55679dadd328d19795934305f8f35ca
7
- data.tar.gz: ddf2c02c68f2310845067f73596dbc504083e94be646acf5ce7e98f2c67e0a98d794672358abc019d4565302b5140bbd036959f13ab3e5590f904e65d5715c29
6
+ metadata.gz: 9cc04c25fad32bd8bfe44d231b0dc51c59f4f248d4125885def6867d158d18d33bd0389f69d6ced75ed8fb65096b43be22ed12ca6f1995e1d2a02860f2ce2bc5
7
+ data.tar.gz: c5a3baa9b0f010f9d592e3fb42b185dad515595768a451763eab62954e987989e128b7d6b1fa27abe3ab5f2d362bb13e93d464b50f022d763d4cbd28bd16e183
data/README.md CHANGED
@@ -493,6 +493,27 @@ module MyApp
493
493
  end
494
494
  ```
495
495
 
496
+ #### Tip: Custom properties on a notification per recipient
497
+
498
+ In order to have recipient-specific settings on the notification, override the `recipient_attributes_for(recipient)` method in your notifier:
499
+
500
+ ```ruby
501
+ class CommentNotifier < ApplicationNotifier
502
+ #...
503
+ def recipient_attributes_for(recipient)
504
+ data = super
505
+ data[:priority] = if recipient.participant?
506
+ "high"
507
+ else
508
+ "low"
509
+ end
510
+ data
511
+ end
512
+ end
513
+ ```
514
+
515
+ Assuming you have a `priority` column in the `noticed_notifications` table, it will be set to the value from the hash here. The default properties of the hash are `recipient_type` and `recipient_id`.
516
+
496
517
  ## ✅ Best Practices
497
518
 
498
519
  ### Renaming Notifiers
@@ -118,9 +118,9 @@ module Noticed
118
118
  def evaluate_recipients
119
119
  return unless _recipients
120
120
 
121
- if _recipients.respond_to?(:call)
121
+ if _recipients.respond_to?(:call, true)
122
122
  instance_exec(&_recipients)
123
- elsif _recipients.is_a?(Symbol) && respond_to?(_recipients)
123
+ elsif _recipients.is_a?(Symbol) && respond_to?(_recipients, true)
124
124
  send(_recipients)
125
125
  end
126
126
  end
@@ -18,6 +18,8 @@ module Noticed
18
18
  rescue Noticed::ResponseUnsuccessful => exception
19
19
  if bad_token?(exception.response) && config[:invalid_token]
20
20
  notification.instance_exec(device_token, &config[:invalid_token])
21
+ elsif config[:error_handler]
22
+ notification.instance_exec(exception.response, &config[:error_handler])
21
23
  else
22
24
  raise
23
25
  end
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.7.0"
2
+ VERSION = "2.7.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.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver