Sha256: 8f3887bc98d17b8f2e9e2e49a2f57ed5d816be9b296f5d03ac9fb16aac6a6337

Contents?: true

Size: 1.69 KB

Versions: 14

Compression:

Stored size: 1.69 KB

Contents

class Noti
	include Auth::Concerns::NotificationConcern
	def format_for_sms(resource)
		## in our case we are using two factor so it needs some parameters to be sent in.
		## it expects:
		## to_number,template_name,var_hash,template_sender_id
		## so here we return an array of arguments.
		response = {}
		response[:to_number] = resource.additional_login_param

		## the following three are things which will be specific to the template configured in twofactor.
		response[:template_name] = "test2"
		## that's good i alreay have var1 and var2
		response[:var_hash] = {var1: resource.id.to_s, var2: objects[:payment_id]}
		response[:template_sender_id] = "PATHOF"
		
		response
	end

	def send_sms_background(resource)
		
		job_arguments = [resource.class.name.to_s,resource.id.to_s,"send_transactional_sms",JSON.generate({:notification_id => self.id.to_s, :notification_class => self.class.name.to_s})]
		#Auth::SidekiqUp.sidekiq_running(JSON.generate(job_arguments)) do 
		k = OtpJob.perform_later(job_arguments)
			puts "send sms background : perform_later returns: #{k.to_s}"
		#end
	end

	def send_email_background(resource)
		job_arguments = [resource.class.name.to_s,resource.id.to_s,"send_email",JSON.generate({:notification_id => self.id.to_s, :notification_class => self.class.name.to_s})]
		#Auth::SidekiqUp.sidekiq_running(JSON.generate(job_arguments)) do 
		k = OtpJob.perform_later(job_arguments)
		puts "send email background : perform_later returns: #{k.to_s}"
		#end
	end

	

	########################### TEST METHODS ####################
	def self.dummy
		n = Noti.new
		resource_ids = {}
		resource_ids[User.name] = ["59a5405c421aa90f732c9059"]
		n.resource_ids = JSON.generate(resource_ids)
		n.save
		n
	end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
wordjelly-auth-1.3.9 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.8 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.7 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.6 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.5 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.3 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.2 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.1 spec/dummy/app/models/noti.rb
wordjelly-auth-1.3.0 spec/dummy/app/models/noti.rb
wordjelly-auth-1.2.9 spec/dummy/app/models/noti.rb
wordjelly-auth-1.2.8 spec/dummy/app/models/noti.rb
wordjelly-auth-1.2.6 spec/dummy/app/models/noti.rb
wordjelly-auth-1.2.5 spec/dummy/app/models/noti.rb
wordjelly-auth-1.2.4 spec/dummy/app/models/noti.rb