Reputation: 1580
Anybody have any ideas? The situation is like this: I have a primary rails app and an auxiliary one. The auxiliary app is used to transform a web service request into a RESTful PUT to the main app. The resource the auxiliary app is attempting to add to requires authentication. Any ideas would be much appreciated! Thanks SO!
Upvotes: 1
Views: 766
Reputation: 1580
I think I may have found my own answer by polling some of my IM contacts. The most logical approach is to use the Curb ruby gem. From the aforementioned API, one simply enables the cookie jar, restfully authenticates and then includes the cookie in subsequent HTTP actions requiring authentication ;)
(Will post some code when I get this implemented..)
Would still appreciate comments and or alternatives though!
Upvotes: 0
Reputation: 12426
ActiveResource is used for this purpose:
class MyModel < ActiveResource::Base
self.site = OTHER_APP_URL
self.user = OTHER_APP_USER
self.password = OTHER_APP_PASSWORD
# Rest of the code here
end
Read up on how to talk to RESTful API from ActiveResource here: http://api.rubyonrails.org/classes/ActiveResource/Base.html
Upvotes: 1