iron_worker_ng 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/iron_worker_ng/client.rb +31 -0
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.6.4
@@ -1,5 +1,6 @@
1
1
  require 'ostruct'
2
2
  require 'json'
3
+ require 'base64'
3
4
 
4
5
  require_relative 'api_client'
5
6
 
@@ -91,6 +92,12 @@ module IronWorkerNG
91
92
  OpenStruct.new(res['tasks'][0])
92
93
  end
93
94
 
95
+ def tasks_create_legacy(code_name, params = {}, options = {})
96
+ res = @api.tasks_create(code_name, params_for_legacy(code_name, params), options)
97
+
98
+ OpenStruct.new(res['tasks'][0])
99
+ end
100
+
94
101
  def tasks_cancel(task_id)
95
102
  @api.tasks_cancel(task_id)
96
103
 
@@ -141,10 +148,34 @@ module IronWorkerNG
141
148
  OpenStruct.new(res['schedules'][0])
142
149
  end
143
150
 
151
+ def schedules_create_legacy(code_name, params = {}, options = {})
152
+ res = @api.schedules_create(code_name, params_for_legacy(code_name, params), options)
153
+
154
+ OpenStruct.new(res['schedules'][0])
155
+ end
156
+
144
157
  def schedules_cancel(schedule_id)
145
158
  @api.schedules_cancel(schedule_id)
146
159
 
147
160
  true
148
161
  end
162
+
163
+ private
164
+
165
+ def params_for_legacy(code_name, params)
166
+ attrs = params
167
+
168
+ if params.class != String
169
+ attrs = {}
170
+
171
+ params.keys.each do |k|
172
+ attrs['@' + k.to_s] = params[k]
173
+ end
174
+
175
+ attrs = attrs.to_json
176
+ end
177
+
178
+ {:class_name => code_name, :attr_encoded => Base64.encode64(attrs), :sw_config => {:project_id => project_id, :token => token}}.to_json
179
+ end
149
180
  end
150
181
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_worker_ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-14 00:00:00.000000000 Z
13
+ date: 2012-06-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: iron_core
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  segments:
146
146
  - 0
147
- hash: -817402675
147
+ hash: -592258257
148
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements: