Sha256: 1d9df45bfcdfccefcb10edecf8601b2e953fd12f42b8befa622f7eeefa541e3e

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

require "iron_cuke"
require "base64"
require "json"

module IronWorker
	class Base
		def upload_if_needed(options) :uploaded_successfully end
	end
	
	module TestService
		module Schedule
			def schedule(name, data, options)
				worker = name.classify.constantize.new
				variables = JSON.parse(Base64.decode64(data[:attr_encoded])) if data[:attr_encoded].present?
				variables.each do |k, v|
					worker.instance_variable_set(k.to_sym, v)
				end
				IronCuke.schedule(worker, options)
			end
			
			def cancel_schedule(scheduled_task_id, options={})
				raise "Must include a schedule id." if scheduled_task_id.blank?
				IronCuke.cancel_schedule(scheduled_task_id)
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iron_cuke-0.0.2 lib/iron_cuke/test_service.rb