dailycred 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -17
- data/config/routes.rb +4 -4
- data/lib/dailycred/acts_as_dailycred.rb +2 -2
- data/lib/dailycred/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cd53d8b942f48d6610882d52285a7893313eba1
|
4
|
+
data.tar.gz: d64798b518610785c809d68ce984d5b1c1239238
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee2c06b2773c5e277ac823a73e53afe6c360f7445c2cbcd39293960e381156aa00e09483f4384e32e7951123036248f2f9091d8cdf857882c9bae60aa02fc23
|
7
|
+
data.tar.gz: ef66edae02677497ea2d0058ddf234f3e3e08513cdebb9533328ebce21e852ea6c1dd1481a8f3fdf0bc2ae7469b53254290291b687db4d61f0d6ba3344892d53
|
data/README.md
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
[![Build Status](https://secure.travis-ci.org/dailycred/dailycred.png?branch=master)](https://travis-ci.org/dailycred/dailycred)
|
4
|
-
|
5
|
-
## Introduction
|
1
|
+
## Ruby on Rails
|
6
2
|
|
7
3
|
The Dailycred ruby gem is everything you need to get off the ground running with robust authentication. It includes an [omniauth](https://github.com/intridea/omniauth) provider and a generator to create necessary models and controllers. The generated authentication structure is inspired by [nifty-generators](https://github.com/ryanb/nifty-generators). To get started using Dailycred with Ruby on Rails, the first thing you need to do is add the dailycred gem to your gemfile:
|
8
4
|
|
@@ -30,21 +26,21 @@ While this is enough to get off the ground running with user authentication, thi
|
|
30
26
|
|
31
27
|
## Authenticating
|
32
28
|
|
33
|
-
|
29
|
+
### login_path
|
34
30
|
|
35
31
|
A helper for linking to the authentication url.
|
36
32
|
|
37
33
|
<%= link_to 'sign up', login_path %>
|
38
34
|
# => <a href="/auth/dailycred">sign up</a>
|
39
35
|
|
40
|
-
|
36
|
+
### logout_path
|
41
37
|
|
42
38
|
To logout a user, simply send them to `/auth/logout`.
|
43
39
|
|
44
40
|
<%= link_to 'logout', logout_path %>
|
45
41
|
# => <a href="/auth/logout">logout</a>
|
46
42
|
|
47
|
-
|
43
|
+
### authenticate
|
48
44
|
|
49
45
|
To protect a controller method from unauthorized users, use the 'authorize' helper method as a `before_filter`.
|
50
46
|
|
@@ -111,7 +107,7 @@ You can also connect additional social accounts to an existing user:
|
|
111
107
|
|
112
108
|
There are a few other helper methods available:
|
113
109
|
|
114
|
-
|
110
|
+
### current_user
|
115
111
|
|
116
112
|
Returns the current logged in user or nil. Example usage:
|
117
113
|
|
@@ -119,7 +115,7 @@ Returns the current logged in user or nil. Example usage:
|
|
119
115
|
redirect_to :controller => 'welcome', :action => 'thanks'
|
120
116
|
end
|
121
117
|
|
122
|
-
|
118
|
+
### dailycred
|
123
119
|
|
124
120
|
A helper for instantiating a dailycred client instance. Use as a `before_filter` to load a @dailycred instance variable, or just use it as a helper method. Example usage:
|
125
121
|
|
@@ -137,27 +133,27 @@ or just as a helper
|
|
137
133
|
dailycred.event(current_user.uid, "New Task", @task.name)
|
138
134
|
end
|
139
135
|
|
140
|
-
|
136
|
+
### Tagging a User
|
141
137
|
|
142
138
|
Dailycred provides the ability to 'tag' users, whether for reference in analytics or any other reason. Note that this is a very simple 'tagging' system, and not something you should use for dynamic tagging situations in your application.
|
143
139
|
|
144
140
|
@user.tag 'awesome'
|
145
141
|
@user.untag 'awesome'
|
146
142
|
|
147
|
-
|
143
|
+
### Firing Events
|
148
144
|
|
149
145
|
You can also fire events tied to a specific user - this is helpful for goal tracking and tying actions to a specific user in analytics. We already fire many events for when a user signs up, resets a password, and much more, but you can also use the event system for something more specific for your application.
|
150
146
|
|
151
147
|
# user#fire_event(key, value)
|
152
148
|
@user.fire_event 'task added', @task.name
|
153
149
|
|
154
|
-
|
150
|
+
### Building Referral URLs
|
155
151
|
|
156
152
|
To easily build referral URLs to track sharing amongst your users, use `referral_link(my_site)`, where *my_site* is the url that you wish referred users to be sent to.
|
157
153
|
|
158
154
|
current_user.referral_link("http://www.mysite.com")
|
159
155
|
|
160
|
-
|
156
|
+
### Testing Controllers
|
161
157
|
|
162
158
|
Testing controllers that have the `authenticate` before filter is easy:
|
163
159
|
|
@@ -166,7 +162,7 @@ Testing controllers that have the `authenticate` before filter is easy:
|
|
166
162
|
|
167
163
|
See `dummy/test/functional/post_controller_test.rb` for an example.
|
168
164
|
|
169
|
-
|
165
|
+
### Dailycred API
|
170
166
|
|
171
167
|
For reference, have a look at the [annotated source code.](https://www.dailycred.com/public/docs/ruby/lib/dailycred.html)
|
172
168
|
|
@@ -181,7 +177,7 @@ Where opts is an optional hash for passing options. After initializing your clie
|
|
181
177
|
@dailycred.untag(current_user.uid, "Failed Checkout") # user_id, key
|
182
178
|
|
183
179
|
|
184
|
-
|
180
|
+
### Persona Login
|
185
181
|
|
186
182
|
1. Set your `persona audience` in your [dailycred identity provider settings](https://www.dailycred.com/admin/settings/identity-providers). This will be `http://{your-url}/auth/dailycred/callback`.
|
187
183
|
2. Make sure you have configured your `callback url` in your [dailycred app settings](https://www.dailycred.com/admin/settings)
|
@@ -206,7 +202,7 @@ Where opts is an optional hash for passing options. After initializing your clie
|
|
206
202
|
For more details, visit our [persona documentation](https://www.dailycred.com/docs/persona)
|
207
203
|
|
208
204
|
|
209
|
-
|
205
|
+
### Configuration
|
210
206
|
|
211
207
|
To specify where users should be redirected after authentication actions, setup configure an `after_auth` property on a `Rails.configuration.DAILYCRED_OPTIONS` variable. Example:
|
212
208
|
|
@@ -227,3 +223,4 @@ To specify where users should be redirected after authentication actions, setup
|
|
227
223
|
|
228
224
|
![](https://www.dailycred.com/dc.gif?client_id=dailycred&title=rails_repo "dailycred")
|
229
225
|
|
226
|
+
[![Build Status](https://secure.travis-ci.org/dailycred/dailycred.png?branch=master)](https://travis-ci.org/dailycred/dailycred)
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Dailycred::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
get "/:provider/callback" => "sessions#create"
|
3
|
+
get "/logout" => "sessions#destroy", :as => :logout
|
4
|
+
get "/" => "sessions#info", :as => :auth_info
|
5
5
|
# get "/dailycred", :as => :login
|
6
|
-
|
6
|
+
get "/failure" => "sessions#failure"
|
7
7
|
end
|
@@ -3,7 +3,7 @@ module ActsAsDailycred
|
|
3
3
|
serialize :tags, Array
|
4
4
|
serialize :referred, Array
|
5
5
|
serialize :access_tokens, Hash
|
6
|
-
serialize :
|
6
|
+
serialize :identities, Hash
|
7
7
|
|
8
8
|
extend ActsAsDailycred::SingletonMethods
|
9
9
|
include ActsAsDailycred::InstanceMethods
|
@@ -52,7 +52,7 @@ module ActsAsDailycred
|
|
52
52
|
def update_from_dailycred dc
|
53
53
|
bad = ['updated_at', 'created_at']
|
54
54
|
dc.each do |k,v|
|
55
|
-
self
|
55
|
+
self.send("#{k}=", v) if self.respond_to?(k) and !bad.include?(k.to_s)
|
56
56
|
end
|
57
57
|
save!
|
58
58
|
end
|
data/lib/dailycred/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hank Stoever
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|