grosser-rpx_now 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -39,7 +39,8 @@ View
39
39
  Controller
40
40
  ----------
41
41
  # simple: use defaults
42
- # user_data returns e.g. {:name=>'John Doe',:email=>'john@doe.com',:identifier=>'blug.google.com/openid/dsdfsdfs3f3'}
42
+ # user_data returns e.g.
43
+ # {:name=>'John Doe', :username => 'john', :email=>'john@doe.com', :identifier=>'blug.google.com/openid/dsdfsdfs3f3'}
43
44
  # when no user_data was found (invalid token supplied), data is empty, you may want to handle that seperatly...
44
45
  # your user model must have an identifier column
45
46
  def rpx_token
@@ -89,7 +90,8 @@ Author
89
90
  ======
90
91
  ###Contributors
91
92
  - [DBA](http://github.com/DBA)
93
+ - [dbalatero](http://github.com/dbalatero)
92
94
 
93
95
  [Michael Grosser](http://pragmatig.wordpress.com)
94
96
  grosser.michael@gmail.com
95
- Hereby placed under public domain, do what you want, just do not hold me accountable...
97
+ Hereby placed under public domain, do what you want, just do not hold me accountable...
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'echoe'
3
+
4
+ desc "Run all specs in spec directory"
5
+ task :default do |t|
6
+ options = "--colour --format progress --loadby --reverse"
7
+ files = FileList['spec/**/*_spec.rb']
8
+ system("spec #{options} #{files}")
9
+ end
10
+
11
+ #Gemspec
12
+ begin
13
+ require 'jeweler'
14
+ Jeweler::Tasks.new do |gem|
15
+ porject_name = 'rpx_now'
16
+ gem.name = porject_name
17
+ gem.summary = "Helper to simplify RPX Now user login/creation"
18
+ gem.email = "grosser.michael@gmail.com"
19
+ gem.homepage = "http://github.com/grosser/#{porject_name}"
20
+ gem.authors = ["Michael Grosser"]
21
+ gem.add_dependency ['activesupport']
22
+ end
23
+ rescue LoadError
24
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
25
+ end
26
+
27
+ task :update_gemspec => [:manifest, :build_gemspec]
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
3
- :major: 0
4
2
  :minor: 4
3
+ :patch: 2
4
+ :major: 0
data/lib/rpx_now.rb CHANGED
@@ -115,8 +115,9 @@ EOF
115
115
  data = {}
116
116
  data[:identifier] = user_data['identifier']
117
117
  data[:email] = user_data['verifiedEmail'] || user_data['email']
118
- data[:name] = user_data['displayName'] || user_data['preferredUsername'] || data[:email].sub(/@.*/,'')
119
- data[:id] = user_data['primaryKey'].to_i unless user_data['primaryKey'].to_s.empty?
118
+ data[:username] = user_data['preferredUsername'] || data[:email].sub(/@.*/,'')
119
+ data[:name] = user_data['displayName'] || data[:username]
120
+ data[:id] = user_data['primaryKey'] unless user_data['primaryKey'].to_s.empty?
120
121
  data
121
122
  end
122
123
 
@@ -161,4 +162,4 @@ EOF
161
162
  super.to_s
162
163
  end
163
164
  end
164
- end
165
+ end
data/spec/rpx_now_spec.rb CHANGED
@@ -76,12 +76,17 @@ describe RPXNow do
76
76
 
77
77
  it "parses JSON response to user data" do
78
78
  RPXNow.expects(:post).returns fake_response
79
- RPXNow.user_data('','x').should == {:name=>'Michael Grosser',:email=>'grosser.michael@googlemail.com',:identifier=>"https://www.google.com/accounts/o8/id?id=AItOawmaOlyYezg_WfbgP_qjaUyHjmqZD9qNIVM"}
79
+ RPXNow.user_data('','x').should == {:name=>'Michael Grosser',:email=>'grosser.michael@googlemail.com',:identifier=>"https://www.google.com/accounts/o8/id?id=AItOawmaOlyYezg_WfbgP_qjaUyHjmqZD9qNIVM", :username => 'grosser.michael'}
80
80
  end
81
81
 
82
82
  it "adds a :id when primaryKey was returned" do
83
83
  RPXNow.expects(:post).returns fake_response.sub(%Q("verifiedEmail"), %Q("primaryKey":"2","verifiedEmail"))
84
- RPXNow.user_data('','x')[:id].should == 2
84
+ RPXNow.user_data('','x')[:id].should == '2'
85
+ end
86
+
87
+ it "handles primaryKeys that are not numeric" do
88
+ RPXNow.expects(:post).returns fake_response.sub(%Q("verifiedEmail"), %Q("primaryKey":"dbalatero","verifiedEmail"))
89
+ RPXNow.user_data('','x')[:id].should == 'dbalatero'
85
90
  end
86
91
 
87
92
  it "hands JSON response to supplied block" do
@@ -198,4 +203,4 @@ describe RPXNow do
198
203
  RPXNow.send('to_query', {:one => " abc"}).should == "one=+abc"
199
204
  end
200
205
  end
201
- end
206
+ 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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-15 00:00:00 -07:00
12
+ date: 2009-05-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -28,11 +28,12 @@ executables: []
28
28
 
29
29
  extensions: []
30
30
 
31
- extra_rdoc_files: []
32
-
31
+ extra_rdoc_files:
32
+ - README.markdown
33
33
  files:
34
- - VERSION.yml
35
34
  - README.markdown
35
+ - Rakefile
36
+ - VERSION.yml
36
37
  - lib/rpx_now.rb
37
38
  - spec/rpx_now_spec.rb
38
39
  - spec/spec_helper.rb
@@ -40,7 +41,6 @@ has_rdoc: true
40
41
  homepage: http://github.com/grosser/rpx_now
41
42
  post_install_message:
42
43
  rdoc_options:
43
- - --inline-source
44
44
  - --charset=UTF-8
45
45
  require_paths:
46
46
  - lib
@@ -61,7 +61,8 @@ requirements: []
61
61
  rubyforge_project:
62
62
  rubygems_version: 1.2.0
63
63
  signing_key:
64
- specification_version: 2
64
+ specification_version: 3
65
65
  summary: Helper to simplify RPX Now user login/creation
66
- test_files: []
67
-
66
+ test_files:
67
+ - spec/rpx_now_spec.rb
68
+ - spec/spec_helper.rb