grosser-rpx_now 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -2
- data/VERSION.yml +1 -1
- data/lib/rpx_now.rb +6 -0
- data/spec/rpx_now_spec.rb +18 -12
- metadata +1 -1
data/README.markdown
CHANGED
@@ -67,15 +67,16 @@ users can login to the same account with multiple identifiers.
|
|
67
67
|
RPXNow.map(identifier, primary_key) #add a mapping
|
68
68
|
RPXNow.unmap(identifier, primary_key) #remove a mapping
|
69
69
|
RPXNow.mappings(primary_key) # [identifier1,identifier2,...]
|
70
|
+
RPXNow.all_mappings # [["1",['google.com/dsdas','yahoo.com/asdas']], ["2",[...]], ... ]
|
70
71
|
|
71
72
|
After a primary key is mapped to an identifier, when a user logs in with this identifier,
|
72
|
-
`RPXNow.user_data` will contain his `primaryKey` as `:id`.
|
73
|
+
`RPXNow.user_data` will contain his `primaryKey` as `:id`.
|
74
|
+
A identifyer can only belong to one user (in doubt the last one it was mapped to)
|
73
75
|
|
74
76
|
TODO
|
75
77
|
====
|
76
78
|
- add provider?
|
77
79
|
- add get_contacts (premium rpx service)
|
78
|
-
- add all_mappings
|
79
80
|
|
80
81
|
|
81
82
|
Author
|
data/VERSION.yml
CHANGED
data/lib/rpx_now.rb
CHANGED
@@ -47,6 +47,12 @@ module RPXNow
|
|
47
47
|
data['identifiers']
|
48
48
|
end
|
49
49
|
|
50
|
+
def all_mappings(*args)
|
51
|
+
api_key, version, options = extract_key_version_and_options!(args)
|
52
|
+
data = secure_json_post("/api/v#{version}/all_mappings", :apiKey => api_key).merge(options)
|
53
|
+
data['mappings']
|
54
|
+
end
|
55
|
+
|
50
56
|
def embed_code(subdomain,url)
|
51
57
|
<<EOF
|
52
58
|
<iframe src="https://#{subdomain}.#{HOST}/openid/embed?token_url=#{url}"
|
data/spec/rpx_now_spec.rb
CHANGED
@@ -203,31 +203,37 @@ describe RPXNow do
|
|
203
203
|
describe :mapping_integration do
|
204
204
|
before do
|
205
205
|
@k1 = 'http://test.myopenid.com'
|
206
|
-
RPXNow.unmap(@k1, 1
|
206
|
+
RPXNow.unmap(@k1, 1)
|
207
207
|
@k2 = 'http://test-2.myopenid.com'
|
208
|
-
RPXNow.unmap(@k2, 1
|
208
|
+
RPXNow.unmap(@k2, 1)
|
209
209
|
end
|
210
210
|
|
211
211
|
it "has no mappings when nothing was mapped" do
|
212
|
-
RPXNow.mappings(1
|
212
|
+
RPXNow.mappings(1).should == []
|
213
213
|
end
|
214
214
|
|
215
215
|
it "unmaps mapped keys" do
|
216
|
-
RPXNow.map(@k2, 1
|
217
|
-
RPXNow.unmap(@k2, 1
|
218
|
-
RPXNow.mappings(1
|
216
|
+
RPXNow.map(@k2, 1)
|
217
|
+
RPXNow.unmap(@k2, 1)
|
218
|
+
RPXNow.mappings(1).should == []
|
219
219
|
end
|
220
220
|
|
221
221
|
it "maps keys to a primary key and then retrieves them" do
|
222
|
-
RPXNow.map(@k1, 1
|
223
|
-
RPXNow.map(@k2, 1
|
224
|
-
RPXNow.mappings(1
|
222
|
+
RPXNow.map(@k1, 1)
|
223
|
+
RPXNow.map(@k2, 1)
|
224
|
+
RPXNow.mappings(1).sort.should == [@k2,@k1]
|
225
225
|
end
|
226
226
|
|
227
227
|
it "does not add duplicate mappings" do
|
228
|
-
RPXNow.map(@k1, 1
|
229
|
-
RPXNow.map(@k1, 1
|
230
|
-
RPXNow.mappings(1
|
228
|
+
RPXNow.map(@k1, 1)
|
229
|
+
RPXNow.map(@k1, 1)
|
230
|
+
RPXNow.mappings(1).should == [@k1]
|
231
|
+
end
|
232
|
+
|
233
|
+
it "finds all mappings" do
|
234
|
+
RPXNow.map(@k1, 1)
|
235
|
+
RPXNow.map(@k2, 2)
|
236
|
+
RPXNow.all_mappings.sort.should == [["1", ["http://test.myopenid.com"]], ["2", ["http://test-2.myopenid.com"]]]
|
231
237
|
end
|
232
238
|
end
|
233
239
|
end
|