6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/communify/controllers/sms_controller.rb', line 6
def self.send_message(content, recipient, priority = 0)
resource = CommunifyLog.new(content: content, recipient: recipient, priority: priority, content_type: 0)
if resource.save
resource.update_column(:status, "Message Queued at #{DateTime.now}")
time = resource.read_attribute_before_type_cast(:priority)
attempt = 1
result = Communify::Workers::SmsWorker.perform_in(time.minutes.from_now, resource.id, time, attempt)
return resource.id
else
raise "Error => Resource has not been saved!!"
end
end
|