noticed 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 205cad1bba9c4d875d180be2f65ba4aaab52a32441ce145c81325c49978058be
4
- data.tar.gz: 873716a4c09250b3b5fef685f690fb43a9c99e6b754e66355bac46bdaeac120b
3
+ metadata.gz: 70482becaedf2461851b7c9f8f0afd9c37a2c4caa9c2d5622cf007b212988730
4
+ data.tar.gz: '023579ed0635603e27fe99473bb77b17bda4bce7a0ac9ad0533179a6570693c3'
5
5
  SHA512:
6
- metadata.gz: 6d911291bb8bcf378371e5e3c33eb5e4456a977ce2e9bc19af3301e3fea9d34d85fc9ce0bca71ad1498d041578b858eb1d39bb3b668fcad21da8378a1d7b38e4
7
- data.tar.gz: 64de0e142c6be7482068830d06f96413391ac38f7dbfd7089c80ee70b957ab1e30edbdf9c70670b52e245a182c69c8a417515aedf5f89e7ad8fcae98c4e072ea
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)
@@ -38,8 +38,8 @@ module Noticed
38
38
  end
39
39
 
40
40
  def fetch_constant(name)
41
- option = config[name]
42
- option.is_a?(String) ? option.constantize : evaluate_option(option)
41
+ option = evaluate_option(name)
42
+ option.is_a?(String) ? option.constantize : option
43
43
  end
44
44
 
45
45
  def evaluate_option(name)
@@ -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.1"
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.1
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-20 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.4
103
+ rubygems_version: 3.5.10
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Notifications for Ruby on Rails applications