Sha256: 5eefe3bea8e0faa4a6b4ba35aa02844d866f79d455bc8a978b1a2394f1cf8d82
Contents?: true
Size: 1.18 KB
Versions: 13
Compression:
Stored size: 1.18 KB
Contents
begin require 'delayed_job' module ActionSmser::DeliveryMethods class DelayedJob def self.deliver(sms) ActionSmser::Logger.info "Delivering sms by delayed_job" sms.to_numbers_array.collect do |to| ::Delayed::Job.enqueue(SmsDeliverJob.new(sms, to), :queue => 'sms-deliver', :priority => sms.delivery_options[:delayed_job][:priority].to_i) end end class SmsDeliverJob < ActionSmser::Base def initialize(sms, to) [:body, :from, :sms_type, :re_delivery_of_delivery_report_id, :ttl, :delivery_options].each do |attr| self.send("#{attr}=", sms.send(attr).dup) unless sms.send(attr).nil? end self.send("to=", to) @valid = true self.delivery_options[:delivery_method] = sms.delivery_options[:delayed_job][:delivery_method] end def perform self.deliver end end end end rescue LoadError => e module ActionSmser::DeliveryMethods class DelayedJob def self.deliver(sms) raise "ActionSmser::DeliveryMethods::DelayedJob: NO DELAYED JOB GEM INCLUDED, ADD DELAYED_JOB TO YOUR GEMFILE" end end end end
Version data entries
13 entries across 13 versions & 1 rubygems