requeus 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/requeus.rb +7 -2
- data/lib/requeus/impl.rb +2 -2
- data/lib/requeus/request.rb +5 -4
- data/requeus.gemspec +7 -7
- metadata +18 -15
data/lib/requeus.rb
CHANGED
@@ -8,8 +8,13 @@ require 'requeus/railtie' if defined?(Rails)
|
|
8
8
|
|
9
9
|
module Requeus
|
10
10
|
class << self
|
11
|
-
|
12
|
-
|
11
|
+
# extra_args can be
|
12
|
+
# :headers
|
13
|
+
#:force_endpoint
|
14
|
+
def request queue, method, path, params = {}, extra_args = {}
|
15
|
+
headers = extra_args[:headers] || {}
|
16
|
+
force_endpoint = extra_args[:force_endpoint]
|
17
|
+
Requeus::Impl.instance.request queue, method, path, params, headers, force_endpoint
|
13
18
|
end
|
14
19
|
|
15
20
|
def start_workers
|
data/lib/requeus/impl.rb
CHANGED
@@ -4,8 +4,8 @@ module Requeus
|
|
4
4
|
class Impl
|
5
5
|
include Singleton
|
6
6
|
|
7
|
-
def request queue, method, path, params, headers
|
8
|
-
r = Requeus::Request.new(method, path, params, headers).to_json
|
7
|
+
def request queue, method, path, params, headers, force_endpoint
|
8
|
+
r = Requeus::Request.new(method, path, params, headers, force_endpoint).to_json
|
9
9
|
server_sequence.any? {|q| q.put(queues[queue].name, r)}
|
10
10
|
end
|
11
11
|
|
data/lib/requeus/request.rb
CHANGED
@@ -7,11 +7,12 @@ module ActionDispatch; module Http; class UploadedFile; end; end; end
|
|
7
7
|
|
8
8
|
module Requeus
|
9
9
|
class Request
|
10
|
-
def initialize method, path, params, headers, file_uids = nil
|
10
|
+
def initialize method, path, params, headers, force_endpoint, file_uids = nil
|
11
11
|
@method = method
|
12
12
|
@path = path
|
13
13
|
@params = params.reject{|_, v| as_file(v)}
|
14
14
|
@headers = headers
|
15
|
+
@force_endpoint = force_endpoint
|
15
16
|
|
16
17
|
if file_uids
|
17
18
|
@files = file_uids
|
@@ -23,11 +24,11 @@ module Requeus
|
|
23
24
|
|
24
25
|
def self.from_json json
|
25
26
|
r = JSON.parse(json)
|
26
|
-
new r['method'], r['path'], r['params'], r['headers'], r['files']
|
27
|
+
new r['method'], r['path'], r['params'], r['headers'], r['force_endpoint'], r['files']
|
27
28
|
end
|
28
29
|
|
29
30
|
def do_request endpoint
|
30
|
-
uri = URI.parse endpoint + @path
|
31
|
+
uri = URI.parse(("http://#{@force_endpoint}" || endpoint) + @path)
|
31
32
|
|
32
33
|
req_klass = case @method.upcase
|
33
34
|
when 'GET'
|
@@ -109,7 +110,7 @@ module Requeus
|
|
109
110
|
params.each do |k, v|
|
110
111
|
if v.is_a?(Hash)
|
111
112
|
v.each do |k1, v1|
|
112
|
-
result["#{k.to_s}[#{k1.to_s}]"] =
|
113
|
+
result["#{k.to_s}[#{k1.to_s}]"] = v1
|
113
114
|
end
|
114
115
|
else
|
115
116
|
result[k.to_s] = v
|
data/requeus.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{requeus}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Ilia Ablamonov", "Anatoliy Plastinin", "Cloud Castle Inc."]
|
12
|
-
s.date = %q{2011-05-
|
11
|
+
s.authors = ["Ilia Ablamonov", "Sergey Aksyutin", "Anatoliy Plastinin", "Cloud Castle Inc."]
|
12
|
+
s.date = %q{2011-05-30}
|
13
13
|
s.description = %q{requeus gem is a library for proxying requests}
|
14
14
|
s.email = %q{antlypls@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/tasks/requeus.rake",
|
35
35
|
"requeus.gemspec"
|
36
36
|
]
|
37
|
-
s.homepage = %q{http://github.com/
|
37
|
+
s.homepage = %q{http://github.com/cloudcastle/requeus}
|
38
38
|
s.licenses = ["MIT"]
|
39
39
|
s.require_paths = ["lib"]
|
40
40
|
s.rubygems_version = %q{1.4.2}
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
s.add_runtime_dependency(%q<multipart-post>, ["~> 1.1.0"])
|
51
51
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
52
52
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
-
s.add_development_dependency(%q<jeweler>, ["
|
53
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.6.0"])
|
54
54
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
55
55
|
else
|
56
56
|
s.add_dependency(%q<carrot>, ["~> 0.8.1"])
|
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
s.add_dependency(%q<multipart-post>, ["~> 1.1.0"])
|
60
60
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
61
61
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
|
-
s.add_dependency(%q<jeweler>, ["
|
62
|
+
s.add_dependency(%q<jeweler>, [">= 1.6.0"])
|
63
63
|
s.add_dependency(%q<rcov>, [">= 0"])
|
64
64
|
end
|
65
65
|
else
|
@@ -69,7 +69,7 @@ Gem::Specification.new do |s|
|
|
69
69
|
s.add_dependency(%q<multipart-post>, ["~> 1.1.0"])
|
70
70
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
71
71
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
72
|
-
s.add_dependency(%q<jeweler>, ["
|
72
|
+
s.add_dependency(%q<jeweler>, [">= 1.6.0"])
|
73
73
|
s.add_dependency(%q<rcov>, [">= 0"])
|
74
74
|
end
|
75
75
|
end
|
metadata
CHANGED
@@ -1,25 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: requeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.3
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ilia Ablamonov
|
14
|
+
- Sergey Aksyutin
|
14
15
|
- Anatoliy Plastinin
|
15
16
|
- Cloud Castle Inc.
|
16
17
|
autorequire:
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2011-
|
21
|
+
date: 2011-05-30 00:00:00 +04:00
|
22
|
+
default_executable:
|
21
23
|
dependencies:
|
22
24
|
- !ruby/object:Gem::Dependency
|
25
|
+
type: :runtime
|
23
26
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
27
|
none: false
|
25
28
|
requirements:
|
@@ -31,11 +34,11 @@ dependencies:
|
|
31
34
|
- 8
|
32
35
|
- 1
|
33
36
|
version: 0.8.1
|
34
|
-
type: :runtime
|
35
37
|
requirement: *id001
|
36
38
|
prerelease: false
|
37
39
|
name: carrot
|
38
40
|
- !ruby/object:Gem::Dependency
|
41
|
+
type: :runtime
|
39
42
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
43
|
none: false
|
41
44
|
requirements:
|
@@ -47,11 +50,11 @@ dependencies:
|
|
47
50
|
- 3
|
48
51
|
- 34
|
49
52
|
version: 2.3.34
|
50
|
-
type: :runtime
|
51
53
|
requirement: *id002
|
52
54
|
prerelease: false
|
53
55
|
name: aws
|
54
56
|
- !ruby/object:Gem::Dependency
|
57
|
+
type: :runtime
|
55
58
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
59
|
none: false
|
57
60
|
requirements:
|
@@ -63,11 +66,11 @@ dependencies:
|
|
63
66
|
- 0
|
64
67
|
- 10
|
65
68
|
version: 1.0.10
|
66
|
-
type: :runtime
|
67
69
|
requirement: *id003
|
68
70
|
prerelease: false
|
69
71
|
name: daemons
|
70
72
|
- !ruby/object:Gem::Dependency
|
73
|
+
type: :runtime
|
71
74
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
75
|
none: false
|
73
76
|
requirements:
|
@@ -79,11 +82,11 @@ dependencies:
|
|
79
82
|
- 1
|
80
83
|
- 0
|
81
84
|
version: 1.1.0
|
82
|
-
type: :runtime
|
83
85
|
requirement: *id004
|
84
86
|
prerelease: false
|
85
87
|
name: multipart-post
|
86
88
|
- !ruby/object:Gem::Dependency
|
89
|
+
type: :development
|
87
90
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
91
|
none: false
|
89
92
|
requirements:
|
@@ -93,11 +96,11 @@ dependencies:
|
|
93
96
|
segments:
|
94
97
|
- 0
|
95
98
|
version: "0"
|
96
|
-
type: :development
|
97
99
|
requirement: *id005
|
98
100
|
prerelease: false
|
99
101
|
name: shoulda
|
100
102
|
- !ruby/object:Gem::Dependency
|
103
|
+
type: :development
|
101
104
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
102
105
|
none: false
|
103
106
|
requirements:
|
@@ -109,15 +112,15 @@ dependencies:
|
|
109
112
|
- 0
|
110
113
|
- 0
|
111
114
|
version: 1.0.0
|
112
|
-
type: :development
|
113
115
|
requirement: *id006
|
114
116
|
prerelease: false
|
115
117
|
name: bundler
|
116
118
|
- !ruby/object:Gem::Dependency
|
119
|
+
type: :development
|
117
120
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
121
|
none: false
|
119
122
|
requirements:
|
120
|
-
- - "
|
123
|
+
- - ">="
|
121
124
|
- !ruby/object:Gem::Version
|
122
125
|
hash: 15
|
123
126
|
segments:
|
@@ -125,11 +128,11 @@ dependencies:
|
|
125
128
|
- 6
|
126
129
|
- 0
|
127
130
|
version: 1.6.0
|
128
|
-
type: :development
|
129
131
|
requirement: *id007
|
130
132
|
prerelease: false
|
131
133
|
name: jeweler
|
132
134
|
- !ruby/object:Gem::Dependency
|
135
|
+
type: :development
|
133
136
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
134
137
|
none: false
|
135
138
|
requirements:
|
@@ -139,7 +142,6 @@ dependencies:
|
|
139
142
|
segments:
|
140
143
|
- 0
|
141
144
|
version: "0"
|
142
|
-
type: :development
|
143
145
|
requirement: *id008
|
144
146
|
prerelease: false
|
145
147
|
name: rcov
|
@@ -169,7 +171,8 @@ files:
|
|
169
171
|
- lib/requeus/server.rb
|
170
172
|
- lib/tasks/requeus.rake
|
171
173
|
- requeus.gemspec
|
172
|
-
|
174
|
+
has_rdoc: true
|
175
|
+
homepage: http://github.com/cloudcastle/requeus
|
173
176
|
licenses:
|
174
177
|
- MIT
|
175
178
|
post_install_message:
|
@@ -198,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
201
|
requirements: []
|
199
202
|
|
200
203
|
rubyforge_project:
|
201
|
-
rubygems_version: 1.
|
204
|
+
rubygems_version: 1.4.2
|
202
205
|
signing_key:
|
203
206
|
specification_version: 3
|
204
207
|
summary: requeus
|