Class: RewardWorkers::PointsExpirationReminder
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- RewardWorkers::PointsExpirationReminder
- Defined in:
- app/workers/reward_workers/points_expiration_reminder.rb
Overview
typed: ignore frozen_string_literal: true this worker is used to send push notification to user when their points are about to expire
Instance Method Summary collapse
Methods inherited from ApplicationWorker
Instance Method Details
#perform(user_id) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/workers/reward_workers/points_expiration_reminder.rb', line 6 def perform(user_id) user = User.fetch user_id # skip if user is not present return unless user.present? # send push notification to user push_to_user = ::PushNotification.new 'user' push_to_user.publish_event(:points_expiry_reminder, object_id: user_id) # send email to user NotificationService::Email.new(receiver: :user, user: user).points_expiration_reminder end |