demarches-normaliennes/app/jobs/cron/purge_old_sib_mails_job.rb

10 lines
259 B
Ruby
Raw Normal View History

2021-08-14 12:46:56 +02:00
class Cron::PurgeOldSibMailsJob < Cron::CronJob
2024-06-13 16:40:08 +02:00
self.schedule_expression = "every day at 00:15"
2021-08-14 12:46:56 +02:00
def perform
sib = Sendinblue::API.new
day_to_delete = (Time.zone.today - 31.days).strftime("%Y-%m-%d")
sib.delete_events(day_to_delete)
end
end