noticed 2.2.2 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6dd4d8e1bcf68fd2d318b58a7048c8635ac898207c938a61183f9a4cf8ef750
4
- data.tar.gz: e6b9a3d5b383c2313f16250f3324e52e6065eaf4b5c0992bc6c06449c0cf4a9a
3
+ metadata.gz: 70482becaedf2461851b7c9f8f0afd9c37a2c4caa9c2d5622cf007b212988730
4
+ data.tar.gz: '023579ed0635603e27fe99473bb77b17bda4bce7a0ac9ad0533179a6570693c3'
5
5
  SHA512:
6
- metadata.gz: 782c9a4004e93a1866fba3c011c505f2c2e9a123901e4fdb01f438df7c795842dd44a5541768bd91b26526207ae8fee9314bb45c498f3aeedcc25f095e1f550f
7
- data.tar.gz: c39725666136a726c3d0d1bf3d21f615b6d12ee354acaf524553544bf2d9235996b9a3bdd4ae3a06e0e5180124afe22637029a6b933915b40a6fac24e1e77765
6
+ metadata.gz: 923f424527ae03b0a9cb24d3fc83f59b9b7d914d7b0f53db928cc9d12b6757ee20fa1a7b810735d2a1657f7ee8a5b7efdee03d69de5b73c8fa31dae6c5400dd0
7
+ data.tar.gz: 2fd06825b9afabd447c867b54c8e31207b7c180d32a5f1ff341b543cf90d1cf9f4a1b65d398e230789e51d9b40cce42e3ebd04611f5970e520e9086e3eeae85f
data/README.md CHANGED
@@ -331,6 +331,7 @@ class IosNotifier < Noticed::Event
331
331
  config.before_enqueue = ->{ throw(:abort) unless recipient.registered_ios? }
332
332
  end
333
333
  end
334
+ ```
334
335
 
335
336
  #### Tip: Extracting Delivery Method Configurations
336
337
 
@@ -644,7 +645,7 @@ class DeliveryMethods::WhatsApp < Noticed::DeliveryMethod
644
645
  def deliver
645
646
  # ...
646
647
  config.day #=> #<Proc:0x000f7c8 (lambda)>
647
- evaluate_option(config.day) #=> "Tuesday"
648
+ evaluate_option(:day) #=> "Tuesday"
648
649
  end
649
650
  end
650
651
  ```
@@ -693,12 +694,6 @@ user.notifications.mark_as_unread
693
694
 
694
695
  #### Instance methods
695
696
 
696
- Convert back into a Noticed notifier object:
697
-
698
- ```ruby
699
- @notification.to_notifier
700
- ```
701
-
702
697
  Mark notification as read / unread:
703
698
 
704
699
  ```ruby
@@ -70,8 +70,12 @@ module Noticed
70
70
  end
71
71
 
72
72
  def with(params)
73
- record = params.delete(:record)
74
- new(params: params, record: record)
73
+ if self < Ephemeral
74
+ new(params: params)
75
+ else
76
+ record = params.delete(:record)
77
+ new(params: params, record: record)
78
+ end
75
79
  end
76
80
 
77
81
  def deliver(recipients = nil, **options)
@@ -4,11 +4,15 @@ module Noticed
4
4
  required_options :message
5
5
 
6
6
  def deliver
7
- channel = fetch_constant(:channel) || Noticed::NotificationChannel
8
- stream = evaluate_option(:stream) || recipient
9
- message = evaluate_option(:message)
7
+ channel.broadcast_to stream, evaluate_option(:message)
8
+ end
9
+
10
+ def channel
11
+ fetch_constant(:channel) || Noticed::NotificationChannel
12
+ end
10
13
 
11
- channel.broadcast_to stream, message
14
+ def stream
15
+ evaluate_option(:stream) || recipient
12
16
  end
13
17
  end
14
18
  end
@@ -3,6 +3,12 @@ module Noticed
3
3
  class TwilioMessaging < DeliveryMethod
4
4
  def deliver
5
5
  post_request url, basic_auth: {user: account_sid, pass: auth_token}, form: json.stringify_keys
6
+ rescue Noticed::ResponseUnsuccessful => exception
7
+ if exception.response.code.start_with?("4") && config[:error_handler]
8
+ notification.instance_exec(exception.response, &config[:error_handler])
9
+ else
10
+ raise
11
+ end
6
12
  end
7
13
 
8
14
  def json
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.2.2"
2
+ VERSION = "2.3.0"
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.2.2
4
+ version: 2.3.0
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-03-21 00:00:00.000000000 Z
11
+ date: 2024-05-23 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.6
103
+ rubygems_version: 3.5.10
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Notifications for Ruby on Rails applications