rpx_now 0.6.23 → 0.6.24

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,12 @@
1
1
  # not used, just for hardcore-bundlers
2
- source :gemcutter
2
+ source :rubygems
3
3
 
4
- gem "rake"
5
- gem "json"
6
- gem "jeweler"
4
+ group :dev do
5
+ gem "rake"
6
+ gem "json"
7
+ gem "jeweler"
8
+ end
7
9
 
8
10
  group :test do
9
- gem "rspec"
11
+ gem "rspec", "~>2"
10
12
  end
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.5.2)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ json (1.4.6)
11
+ rake (0.8.7)
12
+ rspec (2.5.0)
13
+ rspec-core (~> 2.5.0)
14
+ rspec-expectations (~> 2.5.0)
15
+ rspec-mocks (~> 2.5.0)
16
+ rspec-core (2.5.1)
17
+ rspec-expectations (2.5.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.5.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ jeweler
26
+ json
27
+ rake
28
+ rspec (~> 2)
data/Rakefile CHANGED
@@ -1,21 +1,22 @@
1
1
  task :default => :spec
2
- require 'spec/rake/spectask'
3
- Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color']}
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new(:spec) do |t|
4
+ t.rspec_opts = '--backtrace --color'
5
+ end
4
6
 
5
7
  begin
6
8
  require 'jeweler'
7
- project_name = 'rpx_now'
8
9
 
9
10
  Jeweler::Tasks.new do |gem|
10
- gem.name = project_name
11
+ gem.name = 'rpx_now'
11
12
  gem.summary = "Helper to simplify RPX Now user login/creation"
12
13
  gem.email = "grosser.michael@gmail.com"
13
- gem.homepage = "http://github.com/grosser/#{project_name}"
14
+ gem.homepage = "http://github.com/grosser/#{gem.name}"
14
15
  gem.authors = ["Michael Grosser"]
15
16
  gem.add_dependency ['json_pure']
16
17
  end
17
18
 
18
19
  Jeweler::GemcutterTasks.new
19
20
  rescue LoadError
20
- puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
21
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler"
21
22
  end
data/Readme.md CHANGED
@@ -26,23 +26,6 @@ Examples
26
26
 
27
27
  [Example application](http://github.com/grosser/rpx_now_example), go play around!
28
28
 
29
- View
30
- ----
31
- <%=RPXNow.embed_code('My-Rpx-Domain', url_for(:controller=>:session, :action=>:rpx_token, :only_path => false))%>
32
- OR
33
- <%=RPXNow.popup_code('Login here...', 'My-Rpx-Domain', url_for(:controller=>:session, :action=>:rpx_token, :only_path => false), options)%>
34
-
35
- ###Options
36
- `:language=>'en'` rpx tries to detect the users language, but you may overwrite it [possible languages](https://rpxnow.com/docs#sign-in_localization)
37
- `:default_provider=>'google'` [possible default providers](https://rpxnow.com/docs#sign-in_default_provider)
38
- `:flags=>'show_provider_list'` [possible flags](https://rpxnow.com/docs#sign-in_interface)
39
- `:html => {:id => 'xxx'}` is added to the popup link (popup_code only)
40
-
41
- ###Unobtrusive / JS-last
42
- `popup_code` can also be called with `:unobtrusive=>true` ( --> just link without javascript include).
43
- To still get the normal popup add `RPXNow.popup_source('My-Rpx-Domain', url_for(:controller=>:session, :action=>:rpx_token, :only_path => false), [options])`.
44
- Options like :language / :flags should be given for both.
45
-
46
29
  environment.rb
47
30
  --------------
48
31
  Rails::Initializer.run do |config|
@@ -56,6 +39,8 @@ environment.rb
56
39
 
57
40
  Controller
58
41
  ----------
42
+ This example uses the SessionsController, if you dont have one built it and add routes(rpx_token is a post request)
43
+
59
44
  skip_before_filter :verify_authenticity_token, :only => [:rpx_token] # RPX does not pass Rails form tokens...
60
45
 
61
46
  # user_data
@@ -80,21 +65,42 @@ Controller
80
65
  # with extended info like friends, accessCredentials, portable contacts. (most Providers do not supply them)
81
66
  RPXNow.user_data(params[:token], :extended => true)[:extended]['friends'][...have a look at the RPX API DOCS...]
82
67
 
68
+ View
69
+ ----
70
+
71
+ <%=RPXNow.embed_code('My-Rpx-Domain', url_for(:controller=>:session, :action=>:rpx_token, :only_path => false))%>
72
+ OR
73
+ <%=RPXNow.popup_code('Login here...', 'My-Rpx-Domain', url_for(:controller=>:session, :action=>:rpx_token, :only_path => false), options)%>
74
+
75
+ ###Options
76
+ `:language=>'en'` rpx tries to detect the users language, but you may overwrite it [possible languages](https://rpxnow.com/docs#sign-in_localization)
77
+ `:default_provider=>'google'` [possible default providers](https://rpxnow.com/docs#sign-in_default_provider)
78
+ `:flags=>'show_provider_list'` [possible flags](https://rpxnow.com/docs#sign-in_interface)
79
+ `:html => {:id => 'xxx'}` is added to the popup link (popup_code only)
80
+
81
+ ###Unobtrusive / JS-last
82
+ `popup_code` can also be called with `:unobtrusive=>true` ( --> just link without javascript include).
83
+ To still get the normal popup add `RPXNow.popup_source('My-Rpx-Domain', url_for(:controller=>:session, :action=>:rpx_token, :only_path => false), [options])`.
84
+ Options like :language / :flags should be given for both.
85
+
83
86
  Advanced
84
87
  --------
85
88
  ### Versions
86
89
  RPXNow.api_version = 2
87
90
 
91
+ ### Custom domain (PRX Plus/Pro)
92
+ RPXNow.domain = 'other-domain.com'
93
+
88
94
  ### Mappings (PRX Plus/Pro)
89
- You can map your primary keys (e.g. user.id) to identifiers, so that
95
+ You can map your primary keys (e.g. user.id) to identifiers, so that<br/>
90
96
  users can login to the same account with multiple identifiers.
91
97
  RPXNow.map(identifier, primary_key) #add a mapping
92
98
  RPXNow.unmap(identifier, primary_key) #remove a mapping
93
99
  RPXNow.mappings(primary_key) # [identifier1,identifier2,...]
94
100
  RPXNow.all_mappings # [["1",['google.com/dsdas','yahoo.com/asdas']], ["2",[...]], ... ]
95
101
 
96
- After a primary key is mapped to an identifier, when a user logs in with this identifier,
97
- `RPXNow.user_data` will contain his `primaryKey` as `:id`.
102
+ After a primary key is mapped to an identifier, when a user logs in with this identifier,
103
+ `RPXNow.user_data` will contain his `primaryKey` as `:id`.
98
104
  A identifyer can only belong to one user (in doubt the last one it was mapped to)
99
105
 
100
106
  ### User integration (e.g. ActiveRecord)
@@ -124,7 +130,7 @@ Post a users activity, on their e.g. Facebook profile, complete with images, tit
124
130
  }
125
131
 
126
132
  ### Offline user data access (RPX Plus/Pro)
127
- Same response as auth_info but can be called with a identifier at any time.
133
+ Same response as auth_info but can be called with a identifier at any time.<br/>
128
134
  Offline Profile Access must be enabled.
129
135
  RPXNow.get_user_data(identifier, :extended => true)
130
136
 
@@ -138,7 +144,7 @@ Author
138
144
  __[rpx_now_gem mailing list](http://groups.google.com/group/rpx_now_gem)__
139
145
 
140
146
 
141
- ###Contributors
147
+ ### [Contributors](http://github.com/grosser/rpx_now/contributors)
142
148
  - [Amunds](http://github.com/Amunds)
143
149
  - [Bob Groeneveld](http://metathoughtfacility.blogspot.com)
144
150
  - [DBA](http://github.com/DBA)
@@ -153,7 +159,8 @@ __[rpx_now_gem mailing list](http://groups.google.com/group/rpx_now_gem)__
153
159
  - [Ladislav Martincik](http://martincik.com)
154
160
  - [Ben Aldred](http://github.com/benaldred)
155
161
  - [Casper Fabricius](http://casperfabricius.com)
162
+ - [Avi Flombaum](http://www.aviflombaum.com)
156
163
 
157
- [Michael Grosser](http://pragmatig.wordpress.com)
158
- grosser.michael@gmail.com
164
+ [Michael Grosser](http://grosser.it)<br/>
165
+ michael@grosser.it<br/>
159
166
  Hereby placed under public domain, do what you want, just do not hold me accountable...
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.23
1
+ 0.6.24
@@ -7,8 +7,11 @@ module RPXNow
7
7
 
8
8
  attr_accessor :api_key
9
9
  attr_accessor :api_version
10
+ attr_accessor :domain
11
+
10
12
  self.api_version = 2
11
-
13
+ self.domain = 'rpxnow.com'
14
+
12
15
  VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
13
16
 
14
17
  # retrieve the users data
@@ -8,7 +8,6 @@ module RPXNow
8
8
  # - parse response
9
9
  # - handle server errors
10
10
  class Api
11
- HOST = 'rpxnow.com'
12
11
  SSL_CERT = File.join(File.dirname(__FILE__), '..', '..', 'certs', 'ssl_cert.pem')
13
12
 
14
13
  def self.call(method, data)
@@ -23,9 +22,9 @@ module RPXNow
23
22
 
24
23
  def self.host(subdomain=nil)
25
24
  if subdomain
26
- "https://#{subdomain}.#{Api::HOST}"
25
+ "https://#{subdomain}.#{RPXNow.domain}"
27
26
  else
28
- "https://#{Api::HOST}"
27
+ "https://#{RPXNow.domain}"
29
28
  end
30
29
  end
31
30
 
@@ -49,7 +48,7 @@ module RPXNow
49
48
  end
50
49
 
51
50
  def self.client
52
- client = Net::HTTP.new(HOST, 443)
51
+ client = Net::HTTP.new(RPXNow.domain, 443)
53
52
  client.use_ssl = true
54
53
  client.ca_file = SSL_CERT
55
54
  client.verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -1,59 +1,57 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rpx_now}
8
- s.version = "0.6.23"
8
+ s.version = "0.6.24"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-07-21}
12
+ s.date = %q{2011-02-21}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.files = [
15
- ".gitignore",
16
- "CHANGELOG",
17
- "Gemfile",
18
- "MIGRATION",
19
- "Rakefile",
20
- "Readme.md",
21
- "VERSION",
22
- "certs/ssl_cert.pem",
23
- "init.rb",
24
- "lib/rpx_now.rb",
25
- "lib/rpx_now/api.rb",
26
- "lib/rpx_now/contacts_collection.rb",
27
- "lib/rpx_now/user_integration.rb",
28
- "lib/rpx_now/user_proxy.rb",
29
- "rpx_now.gemspec",
30
- "spec/fixtures/get_contacts_response.json",
31
- "spec/integration/mapping_spec.rb",
32
- "spec/rpx_now/api_spec.rb",
33
- "spec/rpx_now/contacts_collection_spec.rb",
34
- "spec/rpx_now/user_proxy_spec.rb",
35
- "spec/rpx_now_spec.rb",
36
- "spec/spec_helper.rb"
15
+ "CHANGELOG",
16
+ "Gemfile",
17
+ "Gemfile.lock",
18
+ "MIGRATION",
19
+ "Rakefile",
20
+ "Readme.md",
21
+ "VERSION",
22
+ "certs/ssl_cert.pem",
23
+ "init.rb",
24
+ "lib/rpx_now.rb",
25
+ "lib/rpx_now/api.rb",
26
+ "lib/rpx_now/contacts_collection.rb",
27
+ "lib/rpx_now/user_integration.rb",
28
+ "lib/rpx_now/user_proxy.rb",
29
+ "rpx_now.gemspec",
30
+ "spec/fixtures/get_contacts_response.json",
31
+ "spec/integration/mapping_spec.rb",
32
+ "spec/rpx_now/api_spec.rb",
33
+ "spec/rpx_now/contacts_collection_spec.rb",
34
+ "spec/rpx_now/user_proxy_spec.rb",
35
+ "spec/rpx_now_spec.rb",
36
+ "spec/spec_helper.rb"
37
37
  ]
38
38
  s.homepage = %q{http://github.com/grosser/rpx_now}
39
- s.rdoc_options = ["--charset=UTF-8"]
40
39
  s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.6}
40
+ s.rubygems_version = %q{1.4.2}
42
41
  s.summary = %q{Helper to simplify RPX Now user login/creation}
43
42
  s.test_files = [
43
+ "spec/integration/mapping_spec.rb",
44
+ "spec/rpx_now/api_spec.rb",
44
45
  "spec/rpx_now/contacts_collection_spec.rb",
45
- "spec/rpx_now/api_spec.rb",
46
- "spec/rpx_now/user_proxy_spec.rb",
47
- "spec/integration/mapping_spec.rb",
48
- "spec/spec_helper.rb",
49
- "spec/rpx_now_spec.rb"
46
+ "spec/rpx_now/user_proxy_spec.rb",
47
+ "spec/rpx_now_spec.rb",
48
+ "spec/spec_helper.rb"
50
49
  ]
51
50
 
52
51
  if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
52
  s.specification_version = 3
55
53
 
56
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
55
  s.add_runtime_dependency(%q<json_pure>, [">= 0"])
58
56
  else
59
57
  s.add_dependency(%q<json_pure>, [">= 0"])
@@ -5,23 +5,36 @@ describe RPXNow do
5
5
  body = {'stat' => 'ok'}.merge(replace)
6
6
  mock({:code => "200", :body => body.to_json})
7
7
  end
8
-
8
+
9
+ describe :domain do
10
+ it 'defaults to rpxnow.com' do
11
+ RPXNow.domain.should == 'rpxnow.com'
12
+ end
13
+ end
14
+
15
+ describe :domain= do
16
+ it "is stored" do
17
+ RPXNow.domain = 'domain.com'
18
+ RPXNow.domain.should == 'domain.com'
19
+ end
20
+ end
21
+
9
22
  describe :api_key= do
10
23
  before do
11
24
  RPXNow.api_key='XX'
12
25
  end
13
-
26
+
14
27
  it "is stored" do
15
28
  RPXNow.api_key.should == 'XX'
16
29
  end
17
-
30
+
18
31
  it "stores the api key, so i do not have to supply everytime" do
19
32
  RPXNow::Api.should_receive(:request).
20
33
  with(anything, hash_including(:apiKey => 'XX')).
21
34
  and_return fake_response
22
35
  RPXNow.mappings(1)
23
36
  end
24
-
37
+
25
38
  it "is not overwritten when overwriting for a single request" do
26
39
  RPXNow::Api.should_receive(:request).
27
40
  with(anything, hash_including(:apiKey => 'YY')).
@@ -35,12 +48,12 @@ describe RPXNow do
35
48
  it "is 2 by default" do
36
49
  RPXNow.api_version.should == 2
37
50
  end
38
-
51
+
39
52
  it "is stored" do
40
53
  RPXNow.api_version='XX'
41
54
  RPXNow.api_version.should == 'XX'
42
55
  end
43
-
56
+
44
57
  it "used for every request" do
45
58
  RPXNow.api_version='XX'
46
59
  RPXNow::Api.should_receive(:request).
@@ -48,7 +61,7 @@ describe RPXNow do
48
61
  and_return fake_response
49
62
  RPXNow.mappings(1)
50
63
  end
51
-
64
+
52
65
  it "is not overwritten when overwriting for a single request" do
53
66
  RPXNow.api_version='XX'
54
67
  RPXNow::Api.should_receive(:request).
@@ -57,7 +70,7 @@ describe RPXNow do
57
70
  RPXNow.mappings(1, :api_version => 'YY')
58
71
  RPXNow.api_version.should == 'XX'
59
72
  end
60
-
73
+
61
74
  it "is not passed in data for request" do
62
75
  RPXNow.api_version='XX'
63
76
  RPXNow::Api.should_receive(:request).
@@ -66,7 +79,7 @@ describe RPXNow do
66
79
  RPXNow.mappings(1, :api_version => 'YY')
67
80
  end
68
81
  end
69
-
82
+
70
83
  describe :embed_code do
71
84
  it "contains the subdomain" do
72
85
  RPXNow.embed_code('xxx','my_url').should =~ /xxx/
@@ -79,7 +92,7 @@ describe RPXNow do
79
92
  it "defaults to no language" do
80
93
  RPXNow.embed_code('xxx', 'my_url').should_not =~ /language_preference/
81
94
  end
82
-
95
+
83
96
  it "has a changeable language" do
84
97
  RPXNow.embed_code('xxx', 'my_url', :language => 'es').should =~ /language_preference=es/
85
98
  end
@@ -104,28 +117,28 @@ describe RPXNow do
104
117
  RPXNow.embed_code('xxx','my_url').should =~ /id=\"rpx_now_embed\"/
105
118
  end
106
119
  end
107
-
120
+
108
121
  describe :popup_code do
109
122
  it "defaults to obtrusive output" do
110
123
  RPXNow.popup_code('sign on', 'subdomain', 'http://fake.domain.com/').should =~ /script src=/
111
124
  end
112
-
125
+
113
126
  it "does not change supplied options" do
114
127
  options = {:xxx => 1}
115
128
  RPXNow.popup_code('a','b','c', options)
116
129
  options.should == {:xxx => 1}
117
130
  end
118
-
131
+
119
132
  it "adds html params to link" do
120
133
  options = {:html => {:id => "xxxx"}}
121
134
  RPXNow.popup_code('a','b','c', options).should =~ /id="xxxx"/
122
135
  end
123
-
136
+
124
137
  it "adds rpxnow to given html class" do
125
138
  options = {:html => {:class => "c1 c2"}}
126
139
  RPXNow.popup_code('a','b','c', options).should =~ /class="rpxnow c1 c2"/
127
140
  end
128
-
141
+
129
142
  describe 'obstrusive' do
130
143
  it "does not encode token_url for popup" do
131
144
  expected = %Q(RPXNOW.token_url = 'http://fake.domain.com/')
@@ -143,24 +156,24 @@ describe RPXNow do
143
156
  actual = RPXNow.popup_code('sign on', 'subdomain', 'http://fake.domain.com/', :unobtrusive => true)
144
157
  actual.should == expected
145
158
  end
146
-
159
+
147
160
  it "can change api version" do
148
161
  RPXNow.popup_code('x', 'y', 'z', :unobtrusive => true, :api_version => 'XX').should include("openid/vXX/signin?")
149
162
  end
150
-
163
+
151
164
  it "can change language" do
152
165
  RPXNow.popup_code('x', 'y', 'z', :unobtrusive => true, :language => 'XX').should include("language_preference=XX")
153
166
  end
154
-
167
+
155
168
  it "can add flags" do
156
169
  RPXNow.popup_code('x', 'y', 'z', :unobtrusive => true, :flags => 'test').should include("flags=test")
157
170
  end
158
-
171
+
159
172
  it "can add default_provider" do
160
173
  RPXNow.popup_code('x', 'y', 'z', :unobtrusive => true, :default_provider => 'test').should include("default_provider=test")
161
174
  end
162
175
  end
163
-
176
+
164
177
  it "allows to specify the version of the widget" do
165
178
  RPXNow.popup_code('x','y','z', :api_version => 300).should =~ %r(/openid/v300/signin)
166
179
  end
@@ -168,38 +181,38 @@ describe RPXNow do
168
181
  it "defaults to widget version 2" do
169
182
  RPXNow.popup_code('x','y','z').should =~ %r(/openid/v2/signin)
170
183
  end
171
-
184
+
172
185
  describe 'language' do
173
186
  it "defaults to no language" do
174
187
  RPXNow.popup_code('x','y','z').should_not =~ /RPXNOW.language_preference/
175
188
  end
176
-
189
+
177
190
  it "has a changeable language" do
178
191
  RPXNow.popup_code('x','y','z', :language=>'de').should =~ /RPXNOW.language_preference = 'de'/
179
192
  end
180
193
  end
181
-
194
+
182
195
  describe 'flags' do
183
196
  it "defaults to no language" do
184
197
  RPXNow.popup_code('x','y','z').should_not =~ /RPXNOW.flags/
185
198
  end
186
-
199
+
187
200
  it "can have flags" do
188
201
  RPXNow.popup_code('x','y','z', :flags=>'test').should =~ /RPXNOW.flags = 'test'/
189
202
  end
190
203
  end
191
-
204
+
192
205
  describe 'default_provider' do
193
206
  it "defaults to no provider" do
194
207
  RPXNow.popup_code('x','y','z').should_not =~ /RPXNOW.default_provider/
195
208
  end
196
-
209
+
197
210
  it "can have default_provider" do
198
211
  RPXNow.popup_code('x','y','z', :default_provider=>'test').should =~ /RPXNOW.default_provider = 'test'/
199
212
  end
200
213
  end
201
214
  end
202
-
215
+
203
216
  describe :user_data do
204
217
  before do
205
218
  @response_body = {
@@ -214,7 +227,7 @@ describe RPXNow do
214
227
  @response = fake_response(@response_body)
215
228
  @fake_user_data = {'profile'=>{}}
216
229
  end
217
-
230
+
218
231
  it "raises ApiError when used with an invalid token" do
219
232
  lambda{
220
233
  RPXNow.user_data('xxxx')
@@ -235,13 +248,13 @@ describe RPXNow do
235
248
  RPXNow::Api.should_receive(:request).and_return @response
236
249
  RPXNow.user_data('').should == expected
237
250
  end
238
-
251
+
239
252
  it "deprecated: adds raw profile data if i want it" do
240
253
  RPXNow::Api.should_receive(:request).and_return @response
241
254
  RPXNow.should_receive(:warn)
242
255
  RPXNow.user_data('',:additional => [:raw])[:raw]["verifiedEmail"].should == "grosser.michael@googlemail.com"
243
256
  end
244
-
257
+
245
258
  it "adds raw data if i want it" do
246
259
  RPXNow::Api.should_receive(:request).and_return @response
247
260
  RPXNow.user_data('',:additional => [:raw_response])[:raw_response]['profile']["verifiedEmail"].should == "grosser.michael@googlemail.com"
@@ -253,14 +266,14 @@ describe RPXNow do
253
266
  RPXNow::Api.should_receive(:request).and_return response
254
267
  RPXNow.user_data('')[:id].should == '2'
255
268
  end
256
-
269
+
257
270
  it "handles primaryKeys that are not numeric" do
258
271
  @response_body['profile']['primaryKey'] = "dbalatero"
259
272
  response = fake_response(@response_body)
260
273
  RPXNow::Api.should_receive(:request).and_return response
261
274
  RPXNow.user_data('')[:id].should == 'dbalatero'
262
275
  end
263
-
276
+
264
277
  it "can fetch additional fields" do
265
278
  @response_body['profile']['xxxy'] = "test"
266
279
  response = fake_response(@response_body)
@@ -287,7 +300,7 @@ describe RPXNow do
287
300
  and_return @response
288
301
  RPXNow.user_data('', :extended=>true)
289
302
  end
290
-
303
+
291
304
  it "returns extended data as an additional field" do
292
305
  @response_body['friends'] = {'x' => 1}
293
306
  @response = fake_response(@response_body)
@@ -295,19 +308,19 @@ describe RPXNow do
295
308
  RPXNow::Api.should_receive(:request).and_return @response
296
309
  RPXNow.user_data('', :extended=>true)[:extended].should == {'friends' => {'x' => 1}}
297
310
  end
298
-
311
+
299
312
  it "does not pass raw_response to RPX" do
300
313
  RPXNow::Api.should_receive(:request).
301
314
  with(anything, hash_not_including(:raw_response => true)).
302
315
  and_return @response
303
316
  RPXNow.user_data('', :raw_response=>true)
304
317
  end
305
-
318
+
306
319
  it "can return a raw_response" do
307
320
  RPXNow::Api.should_receive(:request).and_return @response
308
321
  RPXNow.user_data('', :raw_response=>true).should == @response_body.merge('stat' => 'ok')
309
322
  end
310
-
323
+
311
324
  # these 2 tests are kind of duplicates of the api_version/key tests,
312
325
  # but i want to be extra-sure user_data works
313
326
  it "works with api version as option" do
@@ -317,7 +330,7 @@ describe RPXNow do
317
330
  RPXNow.user_data('id', :extended=>'abc', :api_version=>123)
318
331
  RPXNow.api_version.should == API_VERSION
319
332
  end
320
-
333
+
321
334
  it "works with apiKey as option" do
322
335
  RPXNow::Api.should_receive(:request).
323
336
  with('/api/v2/auth_info', hash_including(:apiKey=>'THE KEY')).
@@ -326,7 +339,7 @@ describe RPXNow do
326
339
  RPXNow.api_key.should == API_KEY
327
340
  end
328
341
  end
329
-
342
+
330
343
  describe :set_status do
331
344
  it "sets the status" do
332
345
  RPXNow::Api.should_receive(:request).
@@ -335,19 +348,19 @@ describe RPXNow do
335
348
  RPXNow.set_status('identifier', 'Chillen...')
336
349
  end
337
350
  end
338
-
351
+
339
352
  describe :activity do
340
353
  it "does a api call with the right arguments" do
341
354
  RPXNow::Api.should_receive(:request).with("/api/v2/activity", :identifier=>"identifier", :activity=>'{"test":"something"}', :apiKey=>API_KEY).and_return fake_response
342
355
  RPXNow.activity('identifier', :test => 'something')
343
356
  end
344
-
357
+
345
358
  it "can pass identifier/apiKey" do
346
359
  RPXNow::Api.should_receive(:request).with("/api/v66666/activity", hash_including(:apiKey=>'MYKEY')).and_return fake_response
347
360
  RPXNow.activity('identifier', {:test => 'something'}, :apiKey => 'MYKEY', :api_version => '66666')
348
361
  end
349
362
  end
350
-
363
+
351
364
  describe :parse_user_data do
352
365
  it "reads secondary names" do
353
366
  RPXNow.send(:parse_user_data,{'profile'=>{'preferredUsername'=>'1'}}, {})[:name].should == '1'
@@ -357,7 +370,7 @@ describe RPXNow do
357
370
  RPXNow.send(:parse_user_data,{'profile'=>{'email'=>'1@xxx.com'}}, {})[:name].should == '1'
358
371
  end
359
372
  end
360
-
373
+
361
374
  describe :contacts do
362
375
  it "finds all contacts" do
363
376
  response = fake_response(JSON.parse(File.read('spec/fixtures/get_contacts_response.json')))
@@ -367,7 +380,7 @@ describe RPXNow do
367
380
  RPXNow.contacts('xx').size.should == 5
368
381
  end
369
382
  end
370
-
383
+
371
384
  describe :mappings do
372
385
  it "shows all mappings" do
373
386
  RPXNow::Api.should_receive(:request).
@@ -376,7 +389,7 @@ describe RPXNow do
376
389
  RPXNow.mappings(1).should == ["http://test.myopenid.com/"]
377
390
  end
378
391
  end
379
-
392
+
380
393
  describe :map do
381
394
  it "maps a identifier" do
382
395
  RPXNow::Api.should_receive(:request).
@@ -385,7 +398,7 @@ describe RPXNow do
385
398
  RPXNow.map('http://test.myopenid.com',1)
386
399
  end
387
400
  end
388
-
401
+
389
402
  describe :unmap do
390
403
  it "unmaps a indentifier" do
391
404
  RPXNow::Api.should_receive(:request).
@@ -394,7 +407,7 @@ describe RPXNow do
394
407
  RPXNow.unmap('http://test.myopenid.com', 1)
395
408
  end
396
409
  end
397
-
410
+
398
411
  it "has a VERSION" do
399
412
  RPXNow::VERSION.should =~ /^\d+\.\d+\.\d+$/
400
413
  end
@@ -1,18 +1,16 @@
1
- # ---- requirements
2
- require 'rubygems'
3
- require 'spec'
4
-
5
1
  $LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
6
2
 
7
3
  # ---- setup environment/plugin
8
4
  require File.expand_path("../init", File.dirname(__FILE__))
9
5
  API_KEY = '4b339169026742245b754fa338b9b0aebbd0a733'
10
6
  API_VERSION = RPXNow.api_version
7
+ DOMAIN = RPXNow.domain
11
8
 
12
9
  # ---- rspec
13
- Spec::Runner.configure do |config|
14
- config.before :each do
10
+ RSpec.configure do |config|
11
+ config.before do
15
12
  RPXNow.api_key = API_KEY
16
13
  RPXNow.api_version = API_VERSION
14
+ RPXNow.domain = DOMAIN
17
15
  end
18
- end
16
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpx_now
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 55
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 6
8
- - 23
9
- version: 0.6.23
9
+ - 24
10
+ version: 0.6.24
10
11
  platform: ruby
11
12
  authors:
12
13
  - Michael Grosser
@@ -14,21 +15,23 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-21 00:00:00 +02:00
18
+ date: 2011-02-21 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: json_pure
22
- prerelease: false
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
+ hash: 3
27
28
  segments:
28
29
  - 0
29
30
  version: "0"
30
- type: :runtime
31
+ prerelease: false
31
32
  version_requirements: *id001
33
+ type: :runtime
34
+ name: json_pure
32
35
  description:
33
36
  email: grosser.michael@gmail.com
34
37
  executables: []
@@ -38,9 +41,9 @@ extensions: []
38
41
  extra_rdoc_files: []
39
42
 
40
43
  files:
41
- - .gitignore
42
44
  - CHANGELOG
43
45
  - Gemfile
46
+ - Gemfile.lock
44
47
  - MIGRATION
45
48
  - Rakefile
46
49
  - Readme.md
@@ -65,35 +68,39 @@ homepage: http://github.com/grosser/rpx_now
65
68
  licenses: []
66
69
 
67
70
  post_install_message:
68
- rdoc_options:
69
- - --charset=UTF-8
71
+ rdoc_options: []
72
+
70
73
  require_paths:
71
74
  - lib
72
75
  required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
73
77
  requirements:
74
78
  - - ">="
75
79
  - !ruby/object:Gem::Version
80
+ hash: 3
76
81
  segments:
77
82
  - 0
78
83
  version: "0"
79
84
  required_rubygems_version: !ruby/object:Gem::Requirement
85
+ none: false
80
86
  requirements:
81
87
  - - ">="
82
88
  - !ruby/object:Gem::Version
89
+ hash: 3
83
90
  segments:
84
91
  - 0
85
92
  version: "0"
86
93
  requirements: []
87
94
 
88
95
  rubyforge_project:
89
- rubygems_version: 1.3.6
96
+ rubygems_version: 1.4.2
90
97
  signing_key:
91
98
  specification_version: 3
92
99
  summary: Helper to simplify RPX Now user login/creation
93
100
  test_files:
94
- - spec/rpx_now/contacts_collection_spec.rb
101
+ - spec/integration/mapping_spec.rb
95
102
  - spec/rpx_now/api_spec.rb
103
+ - spec/rpx_now/contacts_collection_spec.rb
96
104
  - spec/rpx_now/user_proxy_spec.rb
97
- - spec/integration/mapping_spec.rb
98
- - spec/spec_helper.rb
99
105
  - spec/rpx_now_spec.rb
106
+ - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- Manifest
2
- pkg
3
- .*.swp
4
- .*.swo
5
- *.autotest
6
- .bundle