dbalatero-evri_rpx 0.1.0 → 0.1.1
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/VERSION +1 -1
- data/certs/cacert.pem +3154 -0
- data/evri_rpx.gemspec +64 -0
- data/lib/evri/rpx/session.rb +3 -2
- data/spec/evri/rpx/session_spec.rb +11 -11
- metadata +3 -2
- data/certs/curl-ca-bundle.crt +0 -4371
data/evri_rpx.gemspec
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{evri_rpx}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["David Balatero"]
|
9
|
+
s.date = %q{2009-06-15}
|
10
|
+
s.email = %q{dbalatero@evri.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"certs/cacert.pem",
|
23
|
+
"evri_rpx.gemspec",
|
24
|
+
"lib/evri/rpx.rb",
|
25
|
+
"lib/evri/rpx/mappings.rb",
|
26
|
+
"lib/evri/rpx/session.rb",
|
27
|
+
"lib/evri/rpx/user.rb",
|
28
|
+
"lib/evri_rpx.rb",
|
29
|
+
"spec/evri/rpx/mappings_spec.rb",
|
30
|
+
"spec/evri/rpx/session_spec.rb",
|
31
|
+
"spec/evri/rpx/user_spec.rb",
|
32
|
+
"spec/fixtures/mappings/identifiers.json",
|
33
|
+
"spec/fixtures/session/map.json",
|
34
|
+
"spec/fixtures/session/normal_error.json",
|
35
|
+
"spec/fixtures/session/service_down_error.json",
|
36
|
+
"spec/fixtures/session/unmap.json",
|
37
|
+
"spec/fixtures/user/dbalatero_facebook.json",
|
38
|
+
"spec/fixtures/user/dbalatero_gmail.json",
|
39
|
+
"spec/fixtures/user/dbalatero_twitter.json",
|
40
|
+
"spec/fixtures/user/dbalatero_yahoo.json",
|
41
|
+
"spec/spec_helper.rb"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/dbalatero/evri_rpx}
|
44
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.4}
|
47
|
+
s.summary = %q{An API wrapper for the RPXNow.com login service.}
|
48
|
+
s.test_files = [
|
49
|
+
"spec/evri/rpx/mappings_spec.rb",
|
50
|
+
"spec/evri/rpx/session_spec.rb",
|
51
|
+
"spec/evri/rpx/user_spec.rb",
|
52
|
+
"spec/spec_helper.rb"
|
53
|
+
]
|
54
|
+
|
55
|
+
if s.respond_to? :specification_version then
|
56
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
57
|
+
s.specification_version = 3
|
58
|
+
|
59
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
60
|
+
else
|
61
|
+
end
|
62
|
+
else
|
63
|
+
end
|
64
|
+
end
|
data/lib/evri/rpx/session.rb
CHANGED
@@ -5,7 +5,7 @@ module Evri
|
|
5
5
|
API_HOST = 'rpxnow.com'
|
6
6
|
ROOT_CA_PATH = File.expand_path(File.join(File.dirname(__FILE__),
|
7
7
|
'..', '..', '..', 'certs',
|
8
|
-
'
|
8
|
+
'cacert.pem'))
|
9
9
|
|
10
10
|
|
11
11
|
class ServiceUnavailableError < StandardError; end
|
@@ -100,7 +100,8 @@ module Evri
|
|
100
100
|
|
101
101
|
def make_request(request)
|
102
102
|
http = Net::HTTP.new(API_HOST, 443)
|
103
|
-
http.
|
103
|
+
http.use_ssl = true
|
104
|
+
http.ca_file = ROOT_CA_PATH
|
104
105
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
105
106
|
http.verify_depth = 5
|
106
107
|
http.request(request)
|
@@ -18,7 +18,7 @@ describe Evri::RPX::Session do
|
|
18
18
|
|
19
19
|
it "should raise an APICallError if RPX returns an error message" do
|
20
20
|
FakeWeb.register_uri(:get,
|
21
|
-
'
|
21
|
+
'https://rpxnow.com:443/api/v2/auth_info',
|
22
22
|
:file => fixture_path('session/normal_error.json'),
|
23
23
|
:status => ['400', 'Bad Request'])
|
24
24
|
lambda {
|
@@ -28,7 +28,7 @@ describe Evri::RPX::Session do
|
|
28
28
|
|
29
29
|
it "should raise ServiceUnavailableError if the service is not available" do
|
30
30
|
FakeWeb.register_uri(:get,
|
31
|
-
'
|
31
|
+
'https://rpxnow.com:443/api/v2/auth_info',
|
32
32
|
:file => fixture_path('session/service_down_error.json'),
|
33
33
|
:status => ['404', 'Not Found'])
|
34
34
|
lambda {
|
@@ -38,7 +38,7 @@ describe Evri::RPX::Session do
|
|
38
38
|
|
39
39
|
it "should return a User object for a mapping" do
|
40
40
|
FakeWeb.register_uri(:get,
|
41
|
-
'
|
41
|
+
'https://rpxnow.com:443/api/v2/auth_info',
|
42
42
|
:file => fixture_path('user/dbalatero_gmail.json'))
|
43
43
|
|
44
44
|
result = @session.auth_info('mytoken')
|
@@ -49,20 +49,20 @@ describe Evri::RPX::Session do
|
|
49
49
|
describe "map" do
|
50
50
|
before(:each) do
|
51
51
|
FakeWeb.register_uri(:get,
|
52
|
-
'
|
52
|
+
'https://rpxnow.com:443/api/v2/map',
|
53
53
|
:file => fixture_path('session/map.json'))
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should take in a User object as the second parameter" do
|
57
57
|
user = mock('user')
|
58
|
-
user.should_receive(:identifier).and_return('
|
58
|
+
user.should_receive(:identifier).and_return('https://www.facebook.com/dbalatero')
|
59
59
|
|
60
60
|
result = @session.map(user, 50)
|
61
61
|
result.should be_true
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should take in a identifier string as the second parameter" do
|
65
|
-
result = @session.map('
|
65
|
+
result = @session.map('https://www.facebook.com/dbalatero', 50)
|
66
66
|
result.should be_true
|
67
67
|
end
|
68
68
|
end
|
@@ -70,7 +70,7 @@ describe Evri::RPX::Session do
|
|
70
70
|
describe "mappings" do
|
71
71
|
it "should return a Mappings object" do
|
72
72
|
FakeWeb.register_uri(:get,
|
73
|
-
'
|
73
|
+
'https://rpxnow.com:443/api/v2/mappings',
|
74
74
|
:file => fixture_path('mappings/identifiers.json'))
|
75
75
|
|
76
76
|
result = @session.mappings('dbalatero')
|
@@ -80,7 +80,7 @@ describe Evri::RPX::Session do
|
|
80
80
|
|
81
81
|
it "should take a User object in" do
|
82
82
|
FakeWeb.register_uri(:get,
|
83
|
-
'
|
83
|
+
'https://rpxnow.com:443/api/v2/mappings',
|
84
84
|
:file => fixture_path('mappings/identifiers.json'))
|
85
85
|
user = mock('user')
|
86
86
|
user.should_receive(:primary_key).and_return('dbalatero')
|
@@ -94,18 +94,18 @@ describe Evri::RPX::Session do
|
|
94
94
|
describe "unmap" do
|
95
95
|
before(:each) do
|
96
96
|
FakeWeb.register_uri(:get,
|
97
|
-
'
|
97
|
+
'https://rpxnow.com:443/api/v2/unmap',
|
98
98
|
:file => fixture_path('session/unmap.json'))
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should take a string as the identifier" do
|
102
|
-
result = @session.unmap('
|
102
|
+
result = @session.unmap('https://www.facebook.com/dbalatero', 50)
|
103
103
|
result.should be_true
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should take a User as the identifier" do
|
107
107
|
user = mock('user')
|
108
|
-
user.should_receive(:identifier).and_return('
|
108
|
+
user.should_receive(:identifier).and_return('https://www.facebook.com/dbalatero')
|
109
109
|
|
110
110
|
result = @session.unmap(user, 50)
|
111
111
|
result.should be_true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbalatero-evri_rpx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Balatero
|
@@ -29,7 +29,8 @@ files:
|
|
29
29
|
- README.rdoc
|
30
30
|
- Rakefile
|
31
31
|
- VERSION
|
32
|
-
- certs/
|
32
|
+
- certs/cacert.pem
|
33
|
+
- evri_rpx.gemspec
|
33
34
|
- lib/evri/rpx.rb
|
34
35
|
- lib/evri/rpx/mappings.rb
|
35
36
|
- lib/evri/rpx/session.rb
|