README.md in token_action-0.0.1 vs README.md in token_action-0.0.2
- old
+ new
@@ -1,10 +1,12 @@
# TokenAction
-[![Build Status](https://secure.travis-ci.org/opennorth/token_action.png)](http://travis-ci.org/opennorth/token_action)
-[![Dependency Status](https://gemnasium.com/opennorth/token_action.png)](https://gemnasium.com/opennorth/token_action)
-[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/opennorth/token_action)
+[![Gem Version](https://badge.fury.io/rb/token_action.svg)](https://badge.fury.io/rb/token_action)
+[![Build Status](https://secure.travis-ci.org/jpmckinney/token_action.png)](https://travis-ci.org/jpmckinney/token_action)
+[![Dependency Status](https://gemnasium.com/jpmckinney/token_action.png)](https://gemnasium.com/jpmckinney/token_action)
+[![Coverage Status](https://coveralls.io/repos/jpmckinney/token_action/badge.png)](https://coveralls.io/r/jpmckinney/token_action)
+[![Code Climate](https://codeclimate.com/github/jpmckinney/token_action.png)](https://codeclimate.com/github/jpmckinney/token_action)
TokenAction lets you create tokens to be used to authenticate actions. For example:
* Create a token for a user to confirm an account
* Create a token for a subscriber to unsubscribe from notifications
@@ -27,11 +29,11 @@
## Basic Usage
Create a shared secret to confirm a user account, for example:
- token = TokenAction::Token.create! :kind => 'User', :args => [1, :confirm]
+ token = TokenAction::Token.create! kind: 'User', args: [1, :confirm]
token.token # a 20-character alphanumeric string like "j7NtCaYfUpZXyDCseKG2"
You can then send the token with instructions to the user via email. When the user visits `/tokens/j7NtCaYfUpZXyDCseKG2/confirm`, TokenAction will look up the token. If not found, it will log an informational message to the Rails logger, set `flash[:alert]` and redirect to the `root_path`. If found, it will call the `redeem_token` method on the `User` class, passing in the arguments `1` and `:confirm`. You must implement the public `redeem_token` method. For example:
class User < ActiveRecord::Base
@@ -52,11 +54,11 @@
### Redirect URLs
To change the default success and failure URLs from `root_path`, edit the `config/initializers/token_action.rb` file created by `rails generate token_action`. You may also set success and failure URLs for each token, by creating tokens with `:success_url` and `:failure_url` arguments:
- token = TokenAction::Token.create! :kind => 'Cat', :success_url => cat_path(1), :failure_url => '/oops'
+ token = TokenAction::Token.create! kind: 'Cat', success_url: cat_path(1), failure_url: '/oops'
**Note:** If you change your URL structure after creating tokens, TokenAction may attempt to redirect to an unroutable path. If a path is unroutable, TokenAction will redirect to another URL in this order of precedence:
* `Token#success_url`
* `TokenAction.success_url`
@@ -70,17 +72,17 @@
### Routes
The TokenAction generator will add `mount TokenAction::Engine => '/token_action'` to your routes, which defines:
- get 'tokens/:token/*path', :to => 'tokens#redeem'
+ get 'tokens/:token/*path', to: 'tokens#redeem'
As such, you can write URLs like `tokens/xxx/confirm` or `tokens/xxx/unsubscribe` or `tokens/xxx/a/b/c`.
To customize the first part of the route, replace `mount TokenAction::Engine => '/token_action'` with something like:
- get 'jetons/:token/*path', :to => 'token_action/tokens#redeem'
+ get 'jetons/:token/*path', to: 'token_action/tokens#redeem'
### Flash messages
The TokenAction generator will create a `config/locales/token_action.en.yml` file with the default messages for when a token is not found, an exception is raised, or the action is performed successfully. You will probably want to change these messages depending on the action taken and the exception raised.
@@ -108,11 +110,11 @@
class TokensController < TokenAction::TokensController
end
And replace the route with something like:
- get 'tokens/:token/*path', :to => 'tokens#redeem'
+ get 'tokens/:token/*path', to: 'tokens#redeem'
You can then override the `redeem` method in your new controller.
## Supported ORMs
@@ -129,15 +131,6 @@
## Caveats
* If you change the name of a class, update the `kind` attribute on its tokens to avoid making them unprocessable.
* Be careful when changing the behavior of a `redeem_token` method, to avoid making tokens unprocessable.
-## Roadmap
-
-* The tokens controller only responds to HTML requests. Pull requests to add JSON and XML responders are welcome!
-* The generators do not have specs.
-
-## Bugs? Questions?
-
-This engine's main repository is on GitHub: [http://github.com/opennorth/token_action](http://github.com/opennorth/token_action), where your contributions, forks, bug reports, feature requests, and feedback are greatly welcomed.
-
-Copyright (c) 2012 Open North Inc., released under the MIT license
+Copyright (c) 2012 James McKinney, released under the MIT license