Module: Marty::Notifications::CreateDeliveries
- Defined in:
- app/services/marty/notifications/create_deliveries.rb
Class Method Summary collapse
Class Method Details
.call(notification:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/services/marty/notifications/create_deliveries.rb', line 5 def call(notification:) configs(notification).map do |config| notification.deliveries.create!( state: :pending, delivery_type: config.delivery_type, recipient: config.recipient, text: config.text ) end end |
.configs(notification) ⇒ Object
16 17 18 19 20 21 |
# File 'app/services/marty/notifications/create_deliveries.rb', line 16 def configs(notification) Marty::Notifications::Config.where( state: :on, event_type: notification.event_type ) end |