dailycred 0.1.27 → 0.1.28
Sign up to get free protection for your applications and to get access to all the features.
- data/dailycred.gemspec +2 -1
- data/lib/dailycred/helper.rb +4 -0
- data/lib/dailycred.rb +2 -0
- data/lib/generators/dailycred_generator.rb +9 -2
- data/lib/generators/templates/sessions_controller.rb +6 -2
- data/lib/omniauth/strategies/dailycred.rb +1 -1
- data/spec/omniauth/strategies/dailycred_spec.rb +1 -1
- data/spec/support/dailycred_spec.rb +2 -2
- metadata +20 -3
- /data/lib/{user → dailycred}/user.rb +0 -0
data/dailycred.gemspec
CHANGED
@@ -8,11 +8,12 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.homepage = "https://www.dailycred.com"
|
9
9
|
gem.add_dependency("omniauth")
|
10
10
|
gem.add_dependency("omniauth-oauth2")
|
11
|
+
gem.add_dependency("securerandom")
|
11
12
|
|
12
13
|
gem.files = `git ls-files`.split("\n")
|
13
14
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
15
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
16
|
gem.name = "dailycred"
|
16
17
|
gem.require_paths = ["lib"]
|
17
|
-
gem.version = "0.1.
|
18
|
+
gem.version = "0.1.28"
|
18
19
|
end
|
data/lib/dailycred.rb
CHANGED
@@ -9,8 +9,9 @@ class DailycredGenerator < Rails::Generators::Base
|
|
9
9
|
APP_ROUTES_LINES =<<-EOS
|
10
10
|
match '/auth/:provider/callback' => 'sessions#create'
|
11
11
|
match "/logout" => "sessions#destroy", :as => :logout
|
12
|
-
match "/auth" => "sessions#info", :as => :
|
13
|
-
match "/auth/dailycred"
|
12
|
+
match "/auth" => "sessions#info", :as => :auth_info
|
13
|
+
match "/auth/dailycred", :as => :auth
|
14
|
+
match "/auth/failure" => "sessions#failure"
|
14
15
|
EOS
|
15
16
|
|
16
17
|
APP_CONTROLLER_LINES =<<-EOS
|
@@ -43,6 +44,12 @@ class DailycredGenerator < Rails::Generators::Base
|
|
43
44
|
config = Rails.configuration
|
44
45
|
@dailycred ||= Dailycred.new(config.DAILYCRED_CLIENT_ID, config.DAILYCRED_SECRET_KEY, config.dc_options)
|
45
46
|
end
|
47
|
+
|
48
|
+
# when making oauth calls, we may need to redirect to our oauth callback url
|
49
|
+
# make sure we have the correct state passed back and forth
|
50
|
+
def set_state
|
51
|
+
@state = session["omniauth.state"] = SecureRandom.uuid
|
52
|
+
end
|
46
53
|
EOS
|
47
54
|
|
48
55
|
APP_HELPER_LINES = <<-EOS
|
@@ -6,13 +6,17 @@ class SessionsController < ApplicationController
|
|
6
6
|
def create
|
7
7
|
@user = User.find_or_create_with_omniauth auth_hash
|
8
8
|
session[:user_id] = @user.id
|
9
|
-
redirect_to
|
9
|
+
redirect_to auth_info_path
|
10
10
|
end
|
11
11
|
|
12
12
|
#GET /logout
|
13
13
|
def destroy
|
14
14
|
session[:user_id] = nil
|
15
|
-
redirect_to
|
15
|
+
redirect_to auth_info_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def failure
|
19
|
+
redirect_to auth_info_path, notice: params[:message]
|
16
20
|
end
|
17
21
|
|
18
22
|
def info
|
@@ -23,7 +23,7 @@ describe OmniAuth::Strategies::Dailycred do
|
|
23
23
|
subject.client.site.should eq("https://www.dailycred.com")
|
24
24
|
end
|
25
25
|
it 'should have the correct authorization url' do
|
26
|
-
subject.client.options[:authorize_url].should eq("/
|
26
|
+
subject.client.options[:authorize_url].should eq("/connect")
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have the correct token url' do
|
@@ -38,14 +38,14 @@ describe Dailycred do
|
|
38
38
|
json = json_response @dc.tag(@user_id, "loser")
|
39
39
|
json["worked"].should == true
|
40
40
|
user = json["user"]
|
41
|
-
|
41
|
+
user["tags"].should include('loser') #will work in next push
|
42
42
|
end
|
43
43
|
|
44
44
|
it "untags a user" do
|
45
45
|
json = json_response @dc.untag(@user_id, "loser")
|
46
46
|
json["worked"].should == true
|
47
47
|
user = json["user"]
|
48
|
-
|
48
|
+
user["tags"].should == nil #will work in next push
|
49
49
|
end
|
50
50
|
|
51
51
|
it "fires an event" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dailycred
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.28
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: securerandom
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description: descript
|
47
63
|
email:
|
48
64
|
- hstove@gmail.com
|
@@ -67,6 +83,8 @@ files:
|
|
67
83
|
- docs/lib/omniauth/strategies/dailycred.html
|
68
84
|
- docs/lib/user/user.html
|
69
85
|
- lib/dailycred.rb
|
86
|
+
- lib/dailycred/helper.rb
|
87
|
+
- lib/dailycred/user.rb
|
70
88
|
- lib/generators/USAGE
|
71
89
|
- lib/generators/dailycred_generator.rb
|
72
90
|
- lib/generators/templates/info.html.erb
|
@@ -78,7 +96,6 @@ files:
|
|
78
96
|
- lib/middleware/middleware.rb
|
79
97
|
- lib/omniauth-dailycred/version.rb
|
80
98
|
- lib/omniauth/strategies/dailycred.rb
|
81
|
-
- lib/user/user.rb
|
82
99
|
- localtest/.gitignore
|
83
100
|
- localtest/Gemfile
|
84
101
|
- localtest/README.rdoc
|
File without changes
|