db_notification.rb
 1# frozen_string_literal: true
 2
 3require_relative "dummy_command"
 4
 5module DbNotification
 6	def self.for(notify, customer, customer_repo)
 7		case notify[:relname]
 8		when "low_balance"
 9			LowBalance.for(customer).then { |lb| lb.method(:notify!) }
10		when "possible_renewal"
11			Command.execution = DummyCommand.new(customer, customer_repo)
12			BillPlanCommand.for(customer)
13		else
14			raise "Unknown notification: #{notify[:relname]}"
15		end
16	end
17end