oauth2 0.0.6 → 0.0.7
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/CHANGELOG.rdoc +4 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/oauth2/client.rb +11 -4
- data/oauth2.gemspec +5 -5
- data/spec/oauth2/access_token_spec.rb +10 -6
- data/spec/spec_helper.rb +1 -1
- metadata +6 -6
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -22,7 +22,7 @@ Below is a fully functional example of a Sinatra application that would authenti
|
|
22
22
|
require 'json'
|
23
23
|
|
24
24
|
def client
|
25
|
-
OAuth2::Client.new('
|
25
|
+
OAuth2::Client.new('app_id', 'app_secret', :site => 'https://graph.facebook.com')
|
26
26
|
end
|
27
27
|
|
28
28
|
get '/auth/facebook' do
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "michael@intridea.com"
|
11
11
|
gem.homepage = "http://github.com/intridea/oauth2"
|
12
12
|
gem.authors = ["Michael Bleigh"]
|
13
|
-
gem.add_dependency 'faraday', '~> 0.
|
13
|
+
gem.add_dependency 'faraday', '~> 0.4.1'
|
14
14
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/lib/oauth2/client.rb
CHANGED
@@ -3,9 +3,16 @@ require 'faraday'
|
|
3
3
|
module OAuth2
|
4
4
|
class Client
|
5
5
|
class << self
|
6
|
-
|
6
|
+
def default_connection_adapter
|
7
|
+
warn '[DEPRECATED] OAuth2::Client#default_connection_adapter is deprecated, use Faraday.default_adapter instead. Will be removed in 0.1.0'
|
8
|
+
Faraday.default_adapter
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_connection_adapter=(adapter)
|
12
|
+
warn '[DEPRECATED] OAuth2::Client#default_connection_adapter is deprecated, use Faraday.default_adapter instead. Will be removed in 0.1.0'
|
13
|
+
Faraday.default_adapter = adapter
|
14
|
+
end
|
7
15
|
end
|
8
|
-
self.default_connection_adapter = :net_http
|
9
16
|
|
10
17
|
attr_accessor :id, :secret, :site, :connection, :options
|
11
18
|
|
@@ -21,13 +28,13 @@ module OAuth2
|
|
21
28
|
# <tt>:access_token_path</tt> :: Specify the path to the access token endpoint.
|
22
29
|
# <tt>:access_token_url</tt> :: Specify the full URL of the access token endpoint.
|
23
30
|
def initialize(client_id, client_secret, opts = {})
|
24
|
-
adapter = opts.delete(:adapter)
|
31
|
+
adapter = opts.delete(:adapter)
|
25
32
|
self.id = client_id
|
26
33
|
self.secret = client_secret
|
27
34
|
self.site = opts.delete(:site) if opts[:site]
|
28
35
|
self.options = opts
|
29
36
|
self.connection = Faraday::Connection.new(site)
|
30
|
-
if adapter != :test
|
37
|
+
if adapter && adapter != :test
|
31
38
|
connection.build { |b| b.adapter(adapter) }
|
32
39
|
end
|
33
40
|
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.7"
|
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-27}
|
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 = [
|
@@ -57,14 +57,14 @@ Gem::Specification.new do |s|
|
|
57
57
|
s.specification_version = 3
|
58
58
|
|
59
59
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
60
|
-
s.add_runtime_dependency(%q<faraday>, ["~> 0.
|
60
|
+
s.add_runtime_dependency(%q<faraday>, ["~> 0.4.1"])
|
61
61
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
62
62
|
else
|
63
|
-
s.add_dependency(%q<faraday>, ["~> 0.
|
63
|
+
s.add_dependency(%q<faraday>, ["~> 0.4.1"])
|
64
64
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
65
65
|
end
|
66
66
|
else
|
67
|
-
s.add_dependency(%q<faraday>, ["~> 0.
|
67
|
+
s.add_dependency(%q<faraday>, ["~> 0.4.1"])
|
68
68
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
69
69
|
end
|
70
70
|
end
|
@@ -5,10 +5,10 @@ describe OAuth2::AccessToken do
|
|
5
5
|
cli = OAuth2::Client.new('abc','def', :site => 'https://api.example.com')
|
6
6
|
cli.connection.build do |b|
|
7
7
|
b.adapter :test do |stub|
|
8
|
-
stub.get('/client?access_token=monkey')
|
9
|
-
stub.post('/client')
|
10
|
-
stub.put('/client')
|
11
|
-
stub.delete('/client')
|
8
|
+
stub.get('/client?access_token=monkey') { |env| [200, {}, 'get'] }
|
9
|
+
stub.post('/client') { |env| [200, {}, 'access_token=' << env[:body]['access_token']] }
|
10
|
+
stub.put('/client') { |env| [200, {}, 'access_token=' << env[:body]['access_token']] }
|
11
|
+
stub.delete('/client') { |env| [200, {}, 'access_token=' << env[:body]['access_token']] }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
cli
|
@@ -24,9 +24,13 @@ describe OAuth2::AccessToken do
|
|
24
24
|
subject.token.should == token
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
it "makes GET requests with access token" do
|
28
|
+
subject.send(:get, 'client').should == 'get'
|
29
|
+
end
|
30
|
+
|
31
|
+
%w(post put delete).each do |http_method|
|
28
32
|
it "makes #{http_method.upcase} requests with access token" do
|
29
|
-
subject.send(http_method.to_sym, 'client').should ==
|
33
|
+
subject.send(http_method.to_sym, 'client').should == 'access_token=monkey'
|
30
34
|
end
|
31
35
|
end
|
32
36
|
end
|
data/spec/spec_helper.rb
CHANGED
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
|
+
- 7
|
9
|
+
version: 0.0.7
|
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-27 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +26,9 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 0.
|
29
|
+
- 4
|
30
|
+
- 1
|
31
|
+
version: 0.4.1
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|