oauth2 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.0.8 (April 27)
2
+
3
+ * Change get_request_token to use POST to conform to OAuth 2.0 spec. (via jeremy)
4
+
1
5
  == 0.0.7 (April 27)
2
6
 
3
7
  * Updating Faraday dependency for improved SSL support (via technoweenie)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -1,10 +1,11 @@
1
1
  module OAuth2
2
2
  class AccessToken
3
- attr_reader :client, :token
3
+ attr_reader :client, :token, :refresh_token
4
4
 
5
- def initialize(client, token)
5
+ def initialize(client, token, refresh_token = nil)
6
6
  @client = client
7
7
  @token = token
8
+ @refresh_token = refresh_token
8
9
  end
9
10
 
10
11
  def request(verb, path, params = {}, headers = {})
@@ -27,4 +28,4 @@ module OAuth2
27
28
  request(:delete, path, params, headers)
28
29
  end
29
30
  end
30
- end
31
+ end
@@ -10,10 +10,11 @@ module OAuth2
10
10
  # in order to successfully verify your request for most OAuth 2.0
11
11
  # endpoints.
12
12
  def get_access_token(code, options = {})
13
- response = @client.request(:get, @client.access_token_url, access_token_params(code, options))
13
+ response = @client.request(:post, @client.access_token_url, access_token_params(code, options))
14
14
  params = Rack::Utils.parse_query(response)
15
- token = params['access_token']
16
- OAuth2::AccessToken.new(@client, token)
15
+ access = params['access_token']
16
+ refresh = params['refresh_token']
17
+ OAuth2::AccessToken.new(@client, access, refresh)
17
18
  end
18
19
 
19
20
  # <b>DEPRECATED:</b> Use #get_access_token instead.
@@ -30,4 +31,4 @@ module OAuth2
30
31
  end
31
32
  end
32
33
  end
33
- end
34
+ end
data/oauth2.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{oauth2}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
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"]
@@ -5,8 +5,8 @@ describe OAuth2::Strategy::WebServer do
5
5
  cli = OAuth2::Client.new('abc','def', :site => 'http://api.example.com')
6
6
  cli.connection.build do |b|
7
7
  b.adapter :test do |stub|
8
- stub.get('/oauth/access_token?code=sushi&client_id=abc&client_secret=def&type=web_server') do |env|
9
- [200, {}, 'a=1&access_token=salmon']
8
+ stub.post('/oauth/access_token') do |env|
9
+ [200, {}, 'a=1&access_token=salmon&refresh_token=trout']
10
10
  end
11
11
  end
12
12
  end
@@ -41,5 +41,9 @@ describe OAuth2::Strategy::WebServer do
41
41
  it 'returns AccessToken with #token' do
42
42
  @access.token.should == 'salmon'
43
43
  end
44
+
45
+ it 'returns AccessToken with #refresh_token' do
46
+ @access.refresh_token.should == 'trout'
47
+ end
44
48
  end
45
- end
49
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 7
9
- version: 0.0.7
8
+ - 8
9
+ version: 0.0.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Bleigh