ActiveResource::BearerAuthentication
Bearer authentication support for ActiveResource.
Installation
Add this line to your application's Gemfile:
gem 'activeresource_bearer_authentication'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activeresource_bearer_authentication
Usage
Set authentication type and token directly:
class MyResource < ActiveResource::Base
self.auth_type = :bearer
self.token = 'my_token'
# ...
end
Alternative: Set token in a block
class MyResource < ActiveResource::Base
self.auth_type = :bearer
self.token do
# Magic happens...
SomeTokenGenerator.get_fresh_token
end
# ...
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request