What is the easiest way to use OAuth with ActiveResource?

I am working with some old code and use ActiveResource for very simple integration with Twitter. I would like to touch the application code as little as possible and just bring OAuth while still using ActiveResource.

Unfortunately, this is not easy for me. I came across the oauth-active-resource , but it is definitely not documented and apparently intended to create full-featured API wrapper libraries. As you can imagine, I would like to avoid creating a whole ActiveResource API wrapper for this change.

Any success stories? In my case, it would be faster to just leave ActiveResource and not work. I am happy that I was mistaken!

+6
ruby ruby-on-rails
source share
2 answers

I had the same problem and built this simple stone:

https://github.com/albertopq/oauth-activeresource

You just need to use the oauth gem to retrieve the access token and assign the http destination to your model. He will use this object instead of ActiveResource :: Connection.

Hope this helps.

+2
source share

I just did this with omniauth and it was surprisingly easy. This screencast and the subsequent will proceed through it. All I needed was an initializer, a controller with input / output actions, and some attributes of my user model to store the Twitter ID and screen name.

+1
source share

All Articles