Browse files

Not auto passing token/project_id to worker and version bump.

  • Loading branch information...
1 parent 597b5c8 commit 6f9399213cd22364ef9f81535862f5060d39325b Andrew Kirilenko committed Apr 24, 2012
Showing with 9 additions and 21 deletions.
  1. +1 −1 VERSION
  2. +2 −2 lib/iron_worker_ng/client.rb
  3. +6 −18 lib/iron_worker_ng/code/ruby.rb
View
2 VERSION
@@ -1 +1 @@
-0.3.5
+0.3.6
View
4 lib/iron_worker_ng/client.rb
@@ -77,7 +77,7 @@ def tasks_get(task_id)
end
def tasks_create(code_name, params = {}, options = {})
- res = @api.tasks_create(code_name, {:token => @api.token, :project_id => @api.project_id, :params => params}.to_json, options)
+ res = @api.tasks_create(code_name, params.class == String ? params : params.to_json, options)
OpenStruct.new(res['tasks'][0])
end
@@ -127,7 +127,7 @@ def schedules_get(schedule_id)
end
def schedules_create(code_name, params = {}, options = {})
- res = @api.schedules_create(code_name, {:token => @api.token, :project_id => @api.project_id, :params => params}.to_json, options)
+ res = @api.schedules_create(code_name, params.class == String ? params : params.to_json, options)
OpenStruct.new(res['schedules'][0])
end
View
24 lib/iron_worker_ng/code/ruby.rb
@@ -45,16 +45,12 @@ def create_runner(zip)
@payload = File.read(payload_file)
-parsed_payload = {}
+@params = {}
begin
- parsed_payload = JSON.parse(@payload)
+ @params = JSON.parse(@payload)
rescue
end
-@iron_token = parsed_payload['token'] || nil
-@iron_project_id = parsed_payload['project_id'] || nil
-@params = parsed_payload['params'] || {}
-
keys = @params.keys
keys.each do |key|
@params[key.to_sym] = @params[key]
@@ -64,22 +60,14 @@ def payload
@payload
end
-def iron_task_id
- @iron_task_id
-end
-
-def iron_token
- @iron_token
-end
-
-def iron_project_id
- @iron_project_id
-end
-
def params
@params
end
+def iron_task_id
+ @iron_task_id
+end
+
require '#{File.basename(@exec.path)}'
exec_class = nil

0 comments on commit 6f93992

Please sign in to comment.