Question

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!

Was it helpful?

Solution

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

OTHER TIPS

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top