exvo-auth 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/exvo-auth.gemspec +2 -1
- data/lib/exvo-auth.rb +1 -0
- data/lib/exvo_auth/autonomous/auth.rb +6 -0
- data/lib/exvo_auth/autonomous/base.rb +2 -2
- data/lib/exvo_auth/autonomous/consumer.rb +1 -7
- data/lib/exvo_auth/autonomous/provider.rb +1 -6
- data/lib/exvo_auth/controllers/merb.rb +1 -1
- data/lib/exvo_auth/controllers/rails.rb +1 -1
- data/test/test_exvo_auth.rb +4 -4
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/exvo-auth.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{exvo-auth}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jacek Becela"]
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
"VERSION",
|
25
25
|
"exvo-auth.gemspec",
|
26
26
|
"lib/exvo-auth.rb",
|
27
|
+
"lib/exvo_auth/autonomous/auth.rb",
|
27
28
|
"lib/exvo_auth/autonomous/base.rb",
|
28
29
|
"lib/exvo_auth/autonomous/cache.rb",
|
29
30
|
"lib/exvo_auth/autonomous/consumer.rb",
|
data/lib/exvo-auth.rb
CHANGED
@@ -50,13 +50,7 @@ class ExvoAuth::Autonomous::Consumer < ExvoAuth::Autonomous::Base
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def authorization!
|
53
|
-
response =
|
54
|
-
:base_uri => params[:site],
|
55
|
-
:basic_auth => {
|
56
|
-
:username => params[:client_id],
|
57
|
-
:password => params[:client_secret]
|
58
|
-
}
|
59
|
-
)
|
53
|
+
response = auth.get("/apps/consumer/authorizations/#{URI.escape(params[:provider_id])}.json")
|
60
54
|
|
61
55
|
@@cache.write(params, response["authorization"])
|
62
56
|
end
|
@@ -11,12 +11,7 @@ class ExvoAuth::Autonomous::Provider < ExvoAuth::Autonomous::Base
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def scopes!
|
14
|
-
response =
|
15
|
-
:base_uri => params[:site],
|
16
|
-
:basic_auth => {
|
17
|
-
:username => params[:client_id],
|
18
|
-
:password => params[:client_secret]
|
19
|
-
},
|
14
|
+
response = auth.get("/apps/provider/authorizations/#{URI.escape(params[:consumer_id])}.json",
|
20
15
|
:query => { :access_token => params[:access_token] }
|
21
16
|
)
|
22
17
|
|
data/test/test_exvo_auth.rb
CHANGED
@@ -9,8 +9,8 @@ class TestExvoAuth < Test::Unit::TestCase
|
|
9
9
|
test "consumer sanity" do
|
10
10
|
c = ExvoAuth::Autonomous::Consumer.new(:provider_id => "baz")
|
11
11
|
authorization = { "access_token" => "qux", "url" => "https://foo/api" }
|
12
|
-
|
13
|
-
c.expects(:
|
12
|
+
auth = stub(:get => { "authorization" => authorization })
|
13
|
+
c.expects(:auth).returns(auth)
|
14
14
|
|
15
15
|
assert_equal authorization, c.send(:authorization)
|
16
16
|
assert_equal authorization, c.send(:authorization) # second time from cache, without touching httparty
|
@@ -18,8 +18,8 @@ class TestExvoAuth < Test::Unit::TestCase
|
|
18
18
|
|
19
19
|
test "provider sanity" do
|
20
20
|
p = ExvoAuth::Autonomous::Provider.new(:consumer_id => "baz", :access_token => "qux")
|
21
|
-
|
22
|
-
p.expects(:
|
21
|
+
auth = stub(:get => {"scope" => "qux quux"})
|
22
|
+
p.expects(:auth).returns(auth)
|
23
23
|
|
24
24
|
assert_equal ["qux", "quux"], p.scopes
|
25
25
|
assert_equal ["qux", "quux"], p.scopes # second time from cache, without touching httparty
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 2
|
9
|
+
version: 0.7.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jacek Becela
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- VERSION
|
91
91
|
- exvo-auth.gemspec
|
92
92
|
- lib/exvo-auth.rb
|
93
|
+
- lib/exvo_auth/autonomous/auth.rb
|
93
94
|
- lib/exvo_auth/autonomous/base.rb
|
94
95
|
- lib/exvo_auth/autonomous/cache.rb
|
95
96
|
- lib/exvo_auth/autonomous/consumer.rb
|