19 lines
548 B
Ruby
19 lines
548 B
Ruby
class LectureCheckinJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform(*args)
|
|
lecture = Lecture.find_by(start_time: Time.now - 5.minutes..Time.now + 5.minutes)
|
|
return if lecture.empty?
|
|
|
|
puts(HTTParty.post(
|
|
"https://api.pushcut.io/2Kdtb5V7SoDXQOPxCJetk/notifications/Checkin",
|
|
body: {
|
|
input: lecture.id.to_s,
|
|
text: lecture.title,
|
|
title: "Checkin to #{lecture.course.title}"
|
|
}.to_json,
|
|
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
|
))
|
|
end
|
|
end
|