README.md in tokens-2.0.1 vs README.md in tokens-2.1.0
- old
+ new
@@ -1,8 +1,10 @@
# Tokens
-[![Build Status](https://travis-ci.org/pagseguro/rails.png)](https://travis-ci.org/pagseguro/ruby)
+[![Build Status](https://travis-ci.org/fnando/tokens.png)](https://travis-ci.org/fnando/tokens)
+[![Code Climate](https://codeclimate.com/github/fnando/tokens.png)](https://codeclimate.com/github/fnando/tokens)
+[![Gem Version](https://badge.fury.io/rb/tokens.png)](http://badge.fury.io/rb/tokens)
## Usage
### Installation
@@ -20,12 +22,12 @@
```ruby
class User < ActiveRecord::Base
tokenizable
end
-# create a new user; remember that the object need to be saved before creating
-# the token because it depends on the id
+# create a new user; remember that the token requires an existing record
+# because it depends on its id
user = User.create(username: "fnando")
# create token that never expires
user.add_token(:activate)
@@ -41,9 +43,12 @@
# create token with arbitrary data.
user.add_token(:activate, data: {action: "do something"})
# find token by name
user.find_token_by_name(:reset_account)
+
+# find valid token per user context.
+user.find_valid_token(:reset_account, "ea2f14aeac40")
# find token by hash
user.find_token("ea2f14aeac40")
# check if a token has expired