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

10 lines
262 B
Ruby
Raw Normal View History

2021-08-14 12:46:56 +02:00
class Cron::PurgeOldSibMailsJob < Cron::CronJob
self.schedule_expression = "every day at midnight"
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