simple_worker 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/http_enabled.rb CHANGED
@@ -15,23 +15,16 @@ end
15
15
 
16
16
  module SimpleWorker
17
17
 
18
- DEFAULT_HOST = "http://simpleworker.appoxy.com/api/"
19
18
 
20
19
  module HttpEnabled
21
20
 
22
-
23
- def self.host
24
- return DEFAULT_HOST
25
- end
26
-
27
-
28
21
  # body is a hash
29
- def run_http(access_key, secret_key, http_method, command_path, body=nil, parameters={}, extra_headers=nil)
22
+ def run_http(host, access_key, secret_key, http_method, command_path, body=nil, parameters={}, extra_headers=nil)
30
23
  ts = generate_timestamp(Time.now.gmtime)
31
24
  # puts 'timestamp = ' + ts
32
25
  sig = generate_signature_v0(command_path, ts, secret_key)
33
26
  # puts "My signature = " + sig
34
- url = SimpleWorker::HttpEnabled.host + command_path
27
+ url = host + command_path
35
28
  # puts url
36
29
 
37
30
  user_agent = "Ruby Client"
data/lib/simple_worker.rb CHANGED
@@ -20,7 +20,7 @@ module SimpleWorker
20
20
  mystring = f.read
21
21
  end
22
22
  options = {"code"=>mystring, "class_name"=>class_name}
23
- response = run_http(@access_key, @secret_key, :post, "code/put", nil, options)
23
+ response = run_http(@host, @access_key, @secret_key, :post, "code/put", nil, options)
24
24
  puts "response=" + response
25
25
  return ActiveSupport::JSON.decode(response)
26
26
  end
@@ -36,7 +36,7 @@ module SimpleWorker
36
36
  hash_to_send["data"] = data
37
37
  hash_to_send["class_name"] = class_name
38
38
  puts 'hash_to_send=' + hash_to_send.inspect
39
- response = run_http(@access_key, @secret_key, :put, "queue/add", hash_to_send, params)
39
+ response = run_http(@host, @access_key, @secret_key, :put, "queue/add", hash_to_send, params)
40
40
  puts "response=" + response
41
41
  return ActiveSupport::JSON.decode(response)
42
42
  end
@@ -45,7 +45,7 @@ module SimpleWorker
45
45
  def status(task_id)
46
46
  data = {"task_id"=>task_id}
47
47
  #puts run_http(@access_key, @secret_key, :post, "queue/status", nil, {"task_id"=>@task_id})
48
- response = run_http(@access_key, @secret_key, :get, "queue/status", nil, data)
48
+ response = run_http(@host, @access_key, @secret_key, :get, "queue/status", nil, data)
49
49
  puts "response=" + response
50
50
  return ActiveSupport::JSON.decode(response)
51
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder