iron_mq 1.2.8 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/VERSION.yml +2 -2
- data/iron_mq.gemspec +14 -8
- data/lib/iron_mq/client.rb +19 -14
- data/test/test_iron_mq.rb +2 -2
- metadata +30 -8
data/Rakefile
CHANGED
@@ -10,7 +10,9 @@ begin
|
|
10
10
|
gem.email = "travis@iron.io"
|
11
11
|
gem.homepage = "http://www.iron.io"
|
12
12
|
gem.authors = ["Travis Reeder"]
|
13
|
-
gem.add_dependency '
|
13
|
+
gem.add_dependency 'rest-client'
|
14
|
+
gem.add_dependency 'rest'
|
15
|
+
#gem.add_dependency 'typhoeus'
|
14
16
|
gem.required_ruby_version = '>= 1.9'
|
15
17
|
end
|
16
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION.yml
CHANGED
data/iron_mq.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "iron_mq"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Travis Reeder"]
|
12
|
-
s.date = "2011-12-
|
12
|
+
s.date = "2011-12-18"
|
13
13
|
s.description = "Ruby client for IronMQ"
|
14
14
|
s.email = "travis@iron.io"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -39,15 +39,21 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.specification_version = 3
|
40
40
|
|
41
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
-
s.add_runtime_dependency(%q<
|
43
|
-
s.add_runtime_dependency(%q<
|
42
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
43
|
+
s.add_runtime_dependency(%q<rest>, [">= 0"])
|
44
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
45
|
+
s.add_runtime_dependency(%q<rest>, [">= 0"])
|
44
46
|
else
|
45
|
-
s.add_dependency(%q<
|
46
|
-
s.add_dependency(%q<
|
47
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
48
|
+
s.add_dependency(%q<rest>, [">= 0"])
|
49
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
50
|
+
s.add_dependency(%q<rest>, [">= 0"])
|
47
51
|
end
|
48
52
|
else
|
49
|
-
s.add_dependency(%q<
|
50
|
-
s.add_dependency(%q<
|
53
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
54
|
+
s.add_dependency(%q<rest>, [">= 0"])
|
55
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
56
|
+
s.add_dependency(%q<rest>, [">= 0"])
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
data/lib/iron_mq/client.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'json'
|
2
|
-
require 'typhoeus'
|
3
2
|
require 'logger'
|
3
|
+
require 'rest'
|
4
4
|
|
5
5
|
module IronMQ
|
6
6
|
|
@@ -21,6 +21,8 @@ module IronMQ
|
|
21
21
|
|
22
22
|
@base_url = "#{@scheme}://#{@host}:#{@port}/1"
|
23
23
|
|
24
|
+
@rest = Rest::Client.new
|
25
|
+
|
24
26
|
end
|
25
27
|
|
26
28
|
def messages
|
@@ -49,38 +51,41 @@ module IronMQ
|
|
49
51
|
}
|
50
52
|
end
|
51
53
|
|
52
|
-
|
54
|
+
|
55
|
+
def get(path, params={})
|
53
56
|
url = full_url(path)
|
54
57
|
@logger.debug 'url=' + url
|
55
|
-
#response = @http_sess.post(path + "?oauth=#{@token}", {'oauth' => @token}.merge(params).to_json, {"Content-Type" => 'application/json'})
|
56
58
|
req_hash = common_req_hash
|
57
|
-
req_hash[:
|
58
|
-
|
59
|
-
|
59
|
+
req_hash[:params] = params if params
|
60
|
+
@logger.debug 'req_hash=' + req_hash.inspect
|
61
|
+
response = @rest.get(url, req_hash)
|
62
|
+
@logger.debug 'GET response=' + response.inspect
|
60
63
|
res = check_response(response)
|
61
|
-
#@logger.debug 'response: ' + res.inspect
|
62
|
-
#body = response.body
|
63
|
-
#res = JSON.parse(body)
|
64
64
|
return res, response.code
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
67
|
+
def post(path, params={})
|
68
68
|
url = full_url(path)
|
69
69
|
@logger.debug 'url=' + url
|
70
|
+
#response = @http_sess.post(path + "?oauth=#{@token}", {'oauth' => @token}.merge(params).to_json, {"Content-Type" => 'application/json'})
|
70
71
|
req_hash = common_req_hash
|
71
|
-
req_hash[:
|
72
|
-
|
73
|
-
response
|
72
|
+
req_hash[:body] = params.to_json
|
73
|
+
response = @rest.post(url, req_hash)
|
74
|
+
@logger.debug 'POST response=' + response.inspect
|
74
75
|
res = check_response(response)
|
76
|
+
#@logger.debug 'response: ' + res.inspect
|
77
|
+
#body = response.body
|
78
|
+
#res = JSON.parse(body)
|
75
79
|
return res, response.code
|
76
80
|
end
|
77
81
|
|
82
|
+
|
78
83
|
def delete(path, params={})
|
79
84
|
url = "#{base_url}#{path}"
|
80
85
|
@logger.debug 'url=' + url
|
81
86
|
req_hash = common_req_hash
|
82
87
|
req_hash[:params] = params
|
83
|
-
response =
|
88
|
+
response = @rest.delete(url, req_hash)
|
84
89
|
res = check_response(response)
|
85
90
|
#body = response.body
|
86
91
|
#res = JSON.parse(body)
|
data/test/test_iron_mq.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_mq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: rest-client
|
16
|
+
requirement: &14412840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *14412840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: rest
|
27
|
+
requirement: &14412360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,29 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *14412360
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rest-client
|
38
|
+
requirement: &14411880 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *14411880
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rest
|
49
|
+
requirement: &14411400 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *14411400
|
36
58
|
description: Ruby client for IronMQ
|
37
59
|
email: travis@iron.io
|
38
60
|
executables: []
|