grosser-rpx_now 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -3
- data/VERSION.yml +1 -1
- data/lib/rpx_now.rb +1 -1
- data/lib/rpx_now/user_integration.rb +3 -10
- data/lib/rpx_now/user_proxy.rb +19 -0
- data/spec/rpx_now/user_proxy_spec.rb +32 -0
- data/spec/rpx_now_spec.rb +0 -8
- data/spec/spec_helper.rb +10 -22
- metadata +4 -1
data/README.markdown
CHANGED
@@ -78,9 +78,9 @@ A identifyer can only belong to one user (in doubt the last one it was mapped to
|
|
78
78
|
include RPXNow::UserIntegration
|
79
79
|
end
|
80
80
|
|
81
|
-
user.identifiers == RPXNow.mappings(user.id)
|
82
|
-
user.
|
83
|
-
user.
|
81
|
+
user.rpx.identifiers == RPXNow.mappings(user.id)
|
82
|
+
user.rpx.map(identifier) == RPXNow.map(identifier, user.id)
|
83
|
+
user.rpx.unmap(identifier) == RPXNow.unmap(identifier, user.id)
|
84
84
|
|
85
85
|
TODO
|
86
86
|
====
|
data/VERSION.yml
CHANGED
data/lib/rpx_now.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
|
+
require 'rpx_now/user_proxy'
|
1
2
|
module RPXNow
|
2
3
|
module UserIntegration
|
3
|
-
def
|
4
|
-
RPXNow.
|
5
|
-
end
|
6
|
-
|
7
|
-
def map_identifier(identifier)
|
8
|
-
RPXNow.map(identifier, id)
|
9
|
-
end
|
10
|
-
|
11
|
-
def unmap_identifier(identifier)
|
12
|
-
RPXNow.unmap(identifier, id)
|
4
|
+
def rpx
|
5
|
+
RPXNow::UserProxy.new(id)
|
13
6
|
end
|
14
7
|
end
|
15
8
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RPXNow
|
2
|
+
class UserProxy
|
3
|
+
def initialize(id)
|
4
|
+
@id = id
|
5
|
+
end
|
6
|
+
|
7
|
+
def identifiers
|
8
|
+
RPXNow.mappings(@id)
|
9
|
+
end
|
10
|
+
|
11
|
+
def map(identifier)
|
12
|
+
RPXNow.map(identifier, @id)
|
13
|
+
end
|
14
|
+
|
15
|
+
def unmap(identifier)
|
16
|
+
RPXNow.unmap(identifier, @id)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
|
+
require 'rpx_now/user_integration'
|
3
|
+
|
4
|
+
class User
|
5
|
+
include RPXNow::UserIntegration
|
6
|
+
|
7
|
+
def id
|
8
|
+
5
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe RPXNow::UserProxy do
|
13
|
+
before do
|
14
|
+
RPXNow.unmap('http://test.myopenid.com', 5)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has identifiers" do
|
18
|
+
RPXNow.map('http://test.myopenid.com', 5)
|
19
|
+
User.new.rpx.identifiers.should == ['http://test.myopenid.com']
|
20
|
+
end
|
21
|
+
|
22
|
+
it "can map" do
|
23
|
+
User.new.rpx.map('http://test.myopenid.com')
|
24
|
+
User.new.rpx.identifiers.should == ['http://test.myopenid.com']
|
25
|
+
end
|
26
|
+
|
27
|
+
it "can unmap" do
|
28
|
+
RPXNow.map('http://test.myopenid.com', 5)
|
29
|
+
User.new.rpx.unmap('http://test.myopenid.com')
|
30
|
+
User.new.rpx.identifiers.should == []
|
31
|
+
end
|
32
|
+
end
|
data/spec/rpx_now_spec.rb
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
require File.expand_path("spec_helper", File.dirname(__FILE__))
|
2
2
|
|
3
|
-
API_KEY = '4b339169026742245b754fa338b9b0aebbd0a733'
|
4
|
-
API_VERSION = RPXNow.api_version
|
5
|
-
|
6
3
|
describe RPXNow do
|
7
|
-
before do
|
8
|
-
RPXNow.api_key = API_KEY
|
9
|
-
RPXNow.api_version = API_VERSION
|
10
|
-
end
|
11
|
-
|
12
4
|
describe :api_key= do
|
13
5
|
it "stores the api key, so i do not have to supply everytime" do
|
14
6
|
RPXNow.api_key='XX'
|
data/spec/spec_helper.rb
CHANGED
@@ -5,32 +5,20 @@ require 'mocha'
|
|
5
5
|
|
6
6
|
$LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
|
7
7
|
|
8
|
+
# ---- setup environment/plugin
|
9
|
+
require File.expand_path("../init", File.dirname(__FILE__))
|
10
|
+
API_KEY = '4b339169026742245b754fa338b9b0aebbd0a733'
|
11
|
+
API_VERSION = RPXNow.api_version
|
8
12
|
|
9
|
-
# ---- rspec
|
10
|
-
Spec::Runner.configure do |config|
|
11
|
-
config.mock_with :mocha
|
12
|
-
end
|
13
13
|
|
14
14
|
|
15
|
-
# ---- bugfix
|
16
|
-
#`exit?': undefined method `run?' for Test::Unit:Module (NoMethodError)
|
17
|
-
#can be solved with require test/unit but this will result in extra test-output
|
18
|
-
module Test
|
19
|
-
module Unit
|
20
|
-
def self.run?
|
21
|
-
true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
15
|
|
26
16
|
|
27
|
-
# ----
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
it text do
|
34
|
-
pending(&block)
|
17
|
+
# ---- rspec
|
18
|
+
Spec::Runner.configure do |config|
|
19
|
+
config.mock_with :mocha
|
20
|
+
config.before :each do
|
21
|
+
RPXNow.api_key = API_KEY
|
22
|
+
RPXNow.api_version = API_VERSION
|
35
23
|
end
|
36
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grosser-rpx_now
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -36,6 +36,8 @@ files:
|
|
36
36
|
- VERSION.yml
|
37
37
|
- lib/rpx_now.rb
|
38
38
|
- lib/rpx_now/user_integration.rb
|
39
|
+
- lib/rpx_now/user_proxy.rb
|
40
|
+
- spec/rpx_now/user_proxy_spec.rb
|
39
41
|
- spec/rpx_now_spec.rb
|
40
42
|
- spec/spec_helper.rb
|
41
43
|
has_rdoc: true
|
@@ -66,4 +68,5 @@ specification_version: 2
|
|
66
68
|
summary: Helper to simplify RPX Now user login/creation
|
67
69
|
test_files:
|
68
70
|
- spec/rpx_now_spec.rb
|
71
|
+
- spec/rpx_now/user_proxy_spec.rb
|
69
72
|
- spec/spec_helper.rb
|