README.md in dailycred-0.1.6 vs README.md in dailycred-0.1.7

- old
+ new

@@ -1,11 +1,7 @@ -# Dailycred +## Ruby on Rails -[![Build Status](https://secure.travis-ci.org/dailycred/dailycred.png?branch=master)](https://travis-ci.org/dailycred/dailycred) - -## Introduction - 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: gem 'dailycred' Make sure you've signed up for Dailycred, and head over to your [settings](https://www.dailycred.com/admin/settings) page to get your API keys. Once you've done that, head back to the command line and run: @@ -28,25 +24,25 @@ While this is enough to get off the ground running with user authentication, this setup is meant to be lightweight and flexible, so feel free to tinker with any of the generated code to better match your needs. ## Authenticating -#### login_path +### login_path A helper for linking to the authentication url. <%= link_to 'sign up', login_path %> # => <a href="/auth/dailycred">sign up</a> -#### logout_path +### logout_path To logout a user, simply send them to `/auth/logout`. <%= link_to 'logout', logout_path %> # => <a href="/auth/logout">logout</a> -#### authenticate +### authenticate To protect a controller method from unauthorized users, use the 'authorize' helper method as a `before_filter`. #before_filter :authenticate, :except => [:index] #don't authenticate some #before_filter :authenticate, :only => [:create, :new] #only authenticate some @@ -109,19 +105,19 @@ ##Helpers There are a few other helper methods available: -#### current_user +### current_user Returns the current logged in user or nil. Example usage: if !current_user.nil? redirect_to :controller => 'welcome', :action => 'thanks' end -#### dailycred +### dailycred 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: As a before filter: @@ -135,40 +131,40 @@ def index dailycred.event(current_user.uid, "New Task", @task.name) end -#### Tagging a User +### Tagging a User 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. @user.tag 'awesome' @user.untag 'awesome' -#### Firing Events +### Firing Events 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. # user#fire_event(key, value) @user.fire_event 'task added', @task.name -#### Building Referral URLs +### Building Referral URLs 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. current_user.referral_link("http://www.mysite.com") -#### Testing Controllers +### Testing Controllers Testing controllers that have the `authenticate` before filter is easy: # with mocha @controller.stubs(:current_user).returns(@user) See `dummy/test/functional/post_controller_test.rb` for an example. -#### Dailycred API +### Dailycred API For reference, have a look at the [annotated source code.](https://www.dailycred.com/public/docs/ruby/lib/dailycred.html) For all API calls, you must first initalize a Dailycred client: @@ -179,11 +175,11 @@ @dailycred.event(current_user.uid, "New Task", @task.name) # user_id, key, value @dailycred.tag(current_user.uid, "Failed Checkout") # user_id, key @dailycred.untag(current_user.uid, "Failed Checkout") # user_id, key -#### Persona Login +### Persona Login 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`. 2. Make sure you have configured your `callback url` in your [dailycred app settings](https://www.dailycred.com/admin/settings) 3. In `config/omniauth.rb`, configure your middleware options to include your persona audience: @@ -204,11 +200,11 @@ 5. Your user will be redirected to your [persona.org](https://persona.org) to login. If successful, your user will be redirected to your OAuth callback URL and be logged in. For more details, visit our [persona documentation](https://www.dailycred.com/docs/persona) -#### Configuration +### Configuration To specify where users should be redirected after authentication actions, setup configure an `after_auth` property on a `Rails.configuration.DAILYCRED_OPTIONS` variable. Example: # configure where users should be redirected after authentication # @@ -225,5 +221,6 @@ 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request ![](https://www.dailycred.com/dc.gif?client_id=dailycred&title=rails_repo "dailycred") +[![Build Status](https://secure.travis-ci.org/dailycred/dailycred.png?branch=master)](https://travis-ci.org/dailycred/dailycred) \ No newline at end of file