OauthActiveResource
Rails gem that allows you to easily interact with an Oauth secured rest API with the ActiveResource model. You have to provide an http-like object that signs your requests with your already retrieved access_token, like the one that the oauth gem provides (oauth.rubyforge.org/rdoc/classes/OAuth/AccessToken.html)
Getting Started
Assuming that you are using oauth gem:
-
Add into your Gemfile:
gem 'oauth-activeresource'
-
Make your models inherit from OauthActiveResource instead ActiveResource
class MyModel < OauthActiveResource::Base
end
-
Set a before_filter in your controllers to override your connection object with your access_token object
def set_oauth
MyModel.oauth_connection = session[:request_token].get_access_token( :oauth_verifier => params[:oauth_verifier] )
end
Where session is your OAuth::Consumer and params the parameters that the authorizer is sending to your callback method.