notify-engine 0.1.0 → 0.1.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: 49f09cd818de4b46ff8276c410d3f9387e01f5452d353fac70059adbf04c56ce
4
- data.tar.gz: 512d37c685c49874b7bcb47919aaad4f3ebe382a2c566cefb5474dbeb5a0948f
3
+ metadata.gz: 9fe9ea06039bd361b77290faf5aa69925c84239c26f21abaf669052b7b8c81a7
4
+ data.tar.gz: aa981788067172e787f1eb0913f43865a87fe02be53438e87cdf369df1476729
5
5
  SHA512:
6
- metadata.gz: 14994f2a931a9475c25e553ea6ced47f0c12c3994b2045a39fa78501c78c537b80cdd1a05b330f061ecb9fb11761d247985089ba7163ed93f4fc03e42809c235
7
- data.tar.gz: e79f3abe314da7fe841add18b0ec5cb9fbab2610a1775525138a45860d3dd3c5c86af2d834338078e74399d64ae608336adce4229c12a5f39ce70773bda63332
6
+ metadata.gz: 3c83ea43422748436e7d75691316f583413c6532f1c35dae6d474962d71e03d3d22542b1baf9b7c14b1030afb5eb65613f678568cd8ffa0840f13ff399bad463
7
+ data.tar.gz: 01c6c9f6b5cf101846b0746a0646d374eb87eee1837b8f22d67a9c9e319f67b5b3ed66394c800b1ae9bdf638709caa33051cbf45fd9b475f38d556570dc0da29
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.1] - 2026-05-29
9
+
10
+ ### Fixed
11
+
12
+ - Evaluate Procs/Lambdas stored in per-message config (`config.messages[:name]`) and adapter defaults (`config.adapters[:email]`) at dispatch time — previously returned as raw Proc objects for `email_recipients`, `subject`, `email_from`, `email_cc`, `email_bcc`, and `delivery_method`, breaking the documented config pattern
13
+
8
14
  ## [0.1.0] - 2026-05-29
9
15
 
10
16
  ### Added
@@ -18,4 +24,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
24
  - Structured error handling: `Notify::UnknownMessage`, `Notify::MissingRecipients`, `Notify::MissingSubject`, and `Notify::DeliveryError` with aggregated `.adapter_errors` — per-adapter error isolation ensures one failure does not block other adapters
19
25
  - Pluggable adapter system via `Notify.register_adapter(:name, klass)` and `Notify::Adapters::Base` contract (`#deliver`, `.template_extensions`) for custom delivery channels
20
26
 
27
+ [0.1.1]: https://github.com/lstpsche/notify-engine-gem/releases/tag/v0.1.1
21
28
  [0.1.0]: https://github.com/lstpsche/notify-engine-gem/releases/tag/v0.1.0
@@ -158,8 +158,8 @@ module Notify
158
158
  recipients =
159
159
  payload_instance&.resolve(resolution[:recipient_method]) ||
160
160
  raw_payload[resolution[:recipient_kwarg]] ||
161
- message_config(name)&.dig(resolution[:config_recipients_key]) ||
162
- (resolution[:default_recipients_key] && adapter_config(adapter_key)&.dig(resolution[:default_recipients_key]))
161
+ resolve_callable(message_config(name)&.dig(resolution[:config_recipients_key])) ||
162
+ (resolution[:default_recipients_key] && resolve_callable(adapter_config(adapter_key)&.dig(resolution[:default_recipients_key])))
163
163
 
164
164
  recipients = Array(recipients)
165
165
 
@@ -174,7 +174,7 @@ module Notify
174
174
  subject =
175
175
  payload_instance&.resolve(:subject) ||
176
176
  raw_payload[:subject] ||
177
- message_config(name)&.dig(:subject)
177
+ resolve_callable(message_config(name)&.dig(:subject))
178
178
 
179
179
  if resolution[:requires_subject] && (subject.nil? || subject.to_s.strip.empty?)
180
180
  raise MissingSubject, "No subject resolvable for adapter :#{adapter_key}"
@@ -198,28 +198,32 @@ module Notify
198
198
  options[:from] =
199
199
  payload_instance&.resolve(:email_from) ||
200
200
  raw_payload[:email_from] ||
201
- message_config(name)&.dig(:email_from) ||
202
- adapter_config(adapter_key)&.dig(:from)
201
+ resolve_callable(message_config(name)&.dig(:email_from)) ||
202
+ resolve_callable(adapter_config(adapter_key)&.dig(:from))
203
203
 
204
204
  cc = payload_instance&.resolve(:email_cc) ||
205
205
  raw_payload[:email_cc] ||
206
- message_config(name)&.dig(:email_cc)
206
+ resolve_callable(message_config(name)&.dig(:email_cc))
207
207
  options[:cc] = cc if cc
208
208
 
209
209
  bcc = payload_instance&.resolve(:email_bcc) ||
210
210
  raw_payload[:email_bcc] ||
211
- message_config(name)&.dig(:email_bcc)
211
+ resolve_callable(message_config(name)&.dig(:email_bcc))
212
212
  options[:bcc] = bcc if bcc
213
213
  end
214
214
 
215
215
  options[:delivery_method] =
216
216
  raw_payload[:delivery_method] ||
217
- message_config(name)&.dig(:delivery_method) ||
218
- adapter_config(adapter_key)&.dig(:delivery_method)
217
+ resolve_callable(message_config(name)&.dig(:delivery_method)) ||
218
+ resolve_callable(adapter_config(adapter_key)&.dig(:delivery_method))
219
219
 
220
220
  options
221
221
  end
222
222
 
223
+ def resolve_callable(value)
224
+ value.respond_to?(:call) ? value.call : value
225
+ end
226
+
223
227
  def message_config(name)
224
228
  Notify.config.messages[name]
225
229
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Notify
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notify-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Shkoda