README.md in g5_authenticatable_api-0.4.1 vs README.md in g5_authenticatable_api-1.0.0.pre.1
- old
+ new
@@ -7,18 +7,19 @@
to protect an API for a website, or they may be used to protect a stand-alone
service using token-based authentication.
## Current Version
-0.4.0
+1.0.0.pre.1
## Requirements
-* [rails](http://rubyonrails.org/) >= 3.2
+* ruby >= 2.2 (support for ruby 2.4 is still experimental)
-**OR**
+At least one of:
+* [rails](http://rubyonrails.org/) >= 4.1
* [grape](https://github.com/intridea/grape)
## Installation
1. Add this line to your application's Gemfile:
@@ -84,11 +85,11 @@
To require authentication for all API actions:
```ruby
class MyResourceController < ApplicationController
- before_filter :authenticate_api_user!
+ before_action :authenticate_api_user!
respond_to :json
# ...
end
@@ -96,11 +97,11 @@
To require authentication for some API actions:
```ruby
class MyResourceController < ApplicationController
- before_filter :authenticate_api_user!, only: [:create, :update]
+ before_action :authenticate_api_user!, only: [:create, :update]
respond_to :json
# ...
end
@@ -110,11 +111,11 @@
[`G5AuthenticationClient::TokenInfo`](https://github.com/G5/g5_authentication_client/blob/master/lib/g5_authentication_client/token_info.rb)
using the `token_data` helper:
```ruby
class MyResourceController < ApplicationController
- before_filter :authenticate_api_user!
+ before_action :authenticate_api_user!
respond_to :json
def index
token_expiration = token_data.expires_in_seconds
@@ -128,11 +129,11 @@
[warden](https://github.com/hassox/warden) if possible. Otherwise it will return
a [`G5AuthenticationClient::User`](https://github.com/G5/g5_authentication_client/blob/master/lib/g5_authentication_client/user.rb):
```ruby
class MyResourceController < ApplicationController
- before_filter :authenticate_api_user!
+ before_action :authenticate_api_user!
respond_to :json
def index
user = current_api_user
@@ -145,11 +146,11 @@
Finally, you can retrieve the value of the access token in use for this request
by using the `access_token` helper:
```ruby
class MyResourceController < ApplicationController
- before_filter :authenticate_api_user!
+ before_action :authenticate_api_user!
respond_to :json
def index
token = access_token
@@ -304,11 +305,11 @@
Use devise to protect the controller action that serves your ember
application:
```ruby
class WelcomeController < ApplicationController
- before_filter :authenticate_user!
+ before_action :authenticate_user!
def index
end
end
```
@@ -331,10 +332,10 @@
Protect your API actions in your controller:
```ruby
class Api::MyResourcesController < ApplicationController
- before_filter :authenticate_api_user!
+ before_action :authenticate_api_user!
respond_to :json
def show
# ...