oauth2 0.0.4 → 0.0.5
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/LICENSE +1 -1
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/oauth2/client.rb +11 -7
- data/oauth2.gemspec +2 -2
- data/spec/oauth2/access_token_spec.rb +3 -3
- metadata +3 -3
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/oauth2/client.rb
CHANGED
@@ -8,7 +8,7 @@ module OAuth2
|
|
8
8
|
self.default_connection_adapter = :net_http
|
9
9
|
|
10
10
|
attr_accessor :id, :secret, :site, :connection, :options
|
11
|
-
|
11
|
+
|
12
12
|
# Instantiate a new OAuth 2.0 client using the
|
13
13
|
# client ID and client secret registered to your
|
14
14
|
# application.
|
@@ -31,20 +31,24 @@ module OAuth2
|
|
31
31
|
connection.build { |b| b.adapter(adapter) }
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def authorize_url(params = nil)
|
36
36
|
path = options[:authorize_url] || options[:authorize_path] || "/oauth/authorize"
|
37
37
|
connection.build_url(path, params).to_s
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def access_token_url(params = nil)
|
41
41
|
path = options[:access_token_url] || options[:access_token_path] || "/oauth/access_token"
|
42
42
|
connection.build_url(path, params).to_s
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def request(verb, url, params = {}, headers = {})
|
46
|
-
|
47
|
-
|
46
|
+
if verb == :get
|
47
|
+
resp = connection.run_request(verb, url, nil, headers) do |req|
|
48
|
+
req.params.update(params)
|
49
|
+
end
|
50
|
+
else
|
51
|
+
resp = connection.run_request(verb, url, params, headers)
|
48
52
|
end
|
49
53
|
case resp.status
|
50
54
|
when 200...201 then resp.body
|
@@ -58,7 +62,7 @@ module OAuth2
|
|
58
62
|
raise e
|
59
63
|
end
|
60
64
|
end
|
61
|
-
|
65
|
+
|
62
66
|
def web_server; OAuth2::Strategy::WebServer.new(self) end
|
63
67
|
end
|
64
68
|
end
|
data/oauth2.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{oauth2}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Bleigh"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-23}
|
13
13
|
s.description = %q{A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth gem.}
|
14
14
|
s.email = %q{michael@intridea.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -6,9 +6,9 @@ describe OAuth2::AccessToken do
|
|
6
6
|
cli.connection.build do |b|
|
7
7
|
b.adapter :test do |stub|
|
8
8
|
stub.get('/client?access_token=monkey') { |env| [200, {}, 'get'] }
|
9
|
-
stub.post('/client
|
10
|
-
stub.put('/client
|
11
|
-
stub.delete('/client
|
9
|
+
stub.post('/client') { |env| [200, {}, 'post'] }
|
10
|
+
stub.put('/client') { |env| [200, {}, 'put'] }
|
11
|
+
stub.delete('/client') { |env| [200, {}, 'delete'] }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
cli
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Bleigh
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-23 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|