A simple gem that lets you hook into an ActiveResource's request to sign the request before it goes out.
Add this line to your application's Gemfile:
gem 'signed_activeresource'
And then execute:
$ bundle
Or install it yourself as:
$ gem install signed_activeresource
Instead of subclassing ActiveResource::Base
, subclass SignedActiveResource::Base
and set the request_signer
class attribute.
class Person < SignedActiveResource::Base
self.request_signer = signer # an object that responds to sign_request!(http_request)
end
The use case that motivated it is using OAuth, so in that case your request_signer is an instance of
OAuth::AccessToken
which will take care of signing things for you.
ActiveResource
already has a dependency on ActiveSupport
so don't hate on me, I didn't introduce the dependency. The only time I use it is to
inflect some strings. No, I'm not doing a require 'active_support/all'
!
- 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