rack-oauth2 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/rack/oauth2.rb +8 -0
- data/lib/rack/oauth2/access_token.rb +6 -4
- data/lib/rack/oauth2/client.rb +3 -1
- data/rack-oauth2.gemspec +2 -2
- data/spec/rack/oauth2/access_token_spec.rb +2 -2
- metadata +7 -4
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
data/lib/rack/oauth2.rb
CHANGED
@@ -2,17 +2,19 @@ module Rack
|
|
2
2
|
module OAuth2
|
3
3
|
class AccessToken
|
4
4
|
include AttrRequired, AttrOptional
|
5
|
-
attr_required :access_token, :token_type, :
|
5
|
+
attr_required :access_token, :token_type, :httpclient
|
6
6
|
attr_optional :refresh_token, :expires_in, :scope
|
7
|
-
delegate :get, :post, :put, :delete, :to => :
|
7
|
+
delegate :get, :post, :put, :delete, :to => :httpclient
|
8
8
|
|
9
9
|
def initialize(attributes = {})
|
10
10
|
(required_attributes + optional_attributes).each do |key|
|
11
11
|
self.send :"#{key}=", attributes[key]
|
12
12
|
end
|
13
13
|
@token_type = self.class.to_s.split('::').last.underscore.to_sym
|
14
|
-
@
|
15
|
-
|
14
|
+
@httpclient = HTTPClient.new(
|
15
|
+
:agent_name => "#{self.class} (#{VERSION})"
|
16
|
+
)
|
17
|
+
@httpclient.request_filter << Authenticator.new(self)
|
16
18
|
attr_missing!
|
17
19
|
end
|
18
20
|
|
data/lib/rack/oauth2/client.rb
CHANGED
@@ -51,7 +51,9 @@ module Rack
|
|
51
51
|
:client_secret => self.secret
|
52
52
|
)
|
53
53
|
handle_response do
|
54
|
-
HTTPClient.new
|
54
|
+
HTTPClient.new(
|
55
|
+
:agent_name => "#{self.class} (#{VERSION})"
|
56
|
+
).post absolute_uri_for(token_endpoint), Util.compact_hash(params)
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
data/rack-oauth2.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency "activesupport", ">= 2.3"
|
20
20
|
s.add_runtime_dependency "i18n"
|
21
21
|
s.add_runtime_dependency "attr_required", ">= 0.0.3"
|
22
|
-
s.add_development_dependency "rake", ">= 0.8"
|
22
|
+
s.add_development_dependency "rake", ">= 0.8", "< 0.9"
|
23
23
|
s.add_development_dependency "rcov", ">= 0.9"
|
24
|
-
s.add_development_dependency "rspec", ">= 2", "
|
24
|
+
s.add_development_dependency "rspec", ">= 2", "< 2.6"
|
25
25
|
s.add_development_dependency "webmock", ">= 1.6.2"
|
26
26
|
end
|
@@ -51,8 +51,8 @@ describe Rack::OAuth2::AccessToken do
|
|
51
51
|
[:get, :delete, :post, :put].each do |method|
|
52
52
|
describe method do
|
53
53
|
it 'should delegate to HTTPClient with Authenticator filter' do
|
54
|
-
token.
|
55
|
-
token.
|
54
|
+
token.httpclient.should_receive(method).with(resource_endpoint)
|
55
|
+
token.httpclient.request_filter.last.should be_a Rack::OAuth2::AccessToken::Authenticator
|
56
56
|
token.send method, resource_endpoint
|
57
57
|
end
|
58
58
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rack-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- nov matake
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-28 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -87,6 +87,9 @@ dependencies:
|
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: "0.8"
|
90
|
+
- - <
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: "0.9"
|
90
93
|
type: :development
|
91
94
|
version_requirements: *id007
|
92
95
|
- !ruby/object:Gem::Dependency
|
@@ -109,9 +112,9 @@ dependencies:
|
|
109
112
|
- - ">="
|
110
113
|
- !ruby/object:Gem::Version
|
111
114
|
version: "2"
|
112
|
-
- -
|
115
|
+
- - <
|
113
116
|
- !ruby/object:Gem::Version
|
114
|
-
version: "2.
|
117
|
+
version: "2.6"
|
115
118
|
type: :development
|
116
119
|
version_requirements: *id009
|
117
120
|
- !ruby/object:Gem::Dependency
|