em-http-oauth-request 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -8
- data/Rakefile +1 -1
- data/lib/em-http-oauth-request.rb +2 -6
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -26,7 +26,7 @@ The benefit to this is that you can issue asynchronous non-blocking OAuth reques
|
|
26
26
|
req = EventMachine::HttpRequest.new('http://api.twitter.com/1/statuses/home_timeline.json').get
|
27
27
|
oauth_helper = OAuth::Client::Helper.new(req, oauth_params)
|
28
28
|
|
29
|
-
req.options[:head] = (req.options[:head] || {}).merge!({"Authorization
|
29
|
+
req.options[:head] = (req.options[:head] || {}).merge!({"Authorization" => [oauth_helper.header]})
|
30
30
|
req.callback {
|
31
31
|
p req.response
|
32
32
|
|
@@ -34,13 +34,6 @@ The benefit to this is that you can issue asynchronous non-blocking OAuth reques
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
|
37
|
-
|
38
|
-
== Issues
|
39
|
-
|
40
|
-
There's currently an issue with em-http-request in which values of 'Authorization' headers are automatically Base64 encoded. While this is correct for Basic HTTP Authentication, it breaks OAuth requests, which require a number of parameters in the 'Authorization' header.
|
41
|
-
|
42
|
-
For the time being, a simple workaround is to add whitespace to the header (for example, 'Authorization ' in the example above). This works for Twitter's OAuth API, although it may not work for all OAuth providers.
|
43
|
-
|
44
37
|
== License
|
45
38
|
|
46
39
|
(The MIT License)
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ Hoe.plugin :newgem
|
|
13
13
|
$hoe = Hoe.spec 'em-http-oauth-request' do
|
14
14
|
self.developer 'Draconis Software', 'info@draconis.com'
|
15
15
|
self.rubyforge_name = self.name # TODO this is default value
|
16
|
-
self.extra_deps = [['oauth','>= 0.3.6'], ['em-http-request', '>= 0.2.
|
16
|
+
self.extra_deps = [['oauth','>= 0.3.6'], ['em-http-request', '>= 0.2.5']]
|
17
17
|
self.summary = 'Allows em-http-request to be used for OAuth requests.'
|
18
18
|
self.url = 'http://github.com/draconis/em-http-oauth-request'
|
19
19
|
end
|
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module EmHttpOauthRequest
|
5
|
-
VERSION = '0.0
|
5
|
+
VERSION = '0.1.0'
|
6
6
|
end
|
7
7
|
|
8
8
|
require 'oauth'
|
@@ -16,17 +16,13 @@ module OAuth::RequestProxy::EventMachine
|
|
16
16
|
# oauth_params = {:consumer => oauth_consumer, :token => access_token}
|
17
17
|
# req = EventMachine::HttpRequest.new(uri).get(options)
|
18
18
|
# oauth_helper = OAuth::Client::Helper.new(req, oauth_params)
|
19
|
-
# req.options[:head] = (req.options[:head] || {}).merge!({"Authorization
|
19
|
+
# req.options[:head] = (req.options[:head] || {}).merge!({"Authorization" => [oauth_helper.header]})
|
20
20
|
# req.callback {
|
21
21
|
# p req.response
|
22
22
|
#
|
23
23
|
# EventMachine.stop
|
24
24
|
# }
|
25
25
|
# }
|
26
|
-
#
|
27
|
-
# NOTE: currently, em-http-request automatically base64 encodes the 'Authorization' header, which
|
28
|
-
# breaks OAuth. It appears that making the key of the header 'Authorization ' (note the space)
|
29
|
-
# fixes this for the time being.
|
30
26
|
proxies ::EventMachine::HttpClient
|
31
27
|
|
32
28
|
def method
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-http-oauth-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Draconis Software
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-14 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.5
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: hoe
|