我使用的ActiveResource對非Rails的REST API ......其實即便是「休息」的一部分是值得懷疑的,但他們的嘗試:消費非Rails的REST API使用的ActiveResource
Although RESTful applications are ideally stateless, the ALM platform requires sessions to manage locking, client life time, and perform other basic tasks. Session management is performed using a cookie named QCSession.
無論如何,我需要發出一個GET到「身份驗證點/身份驗證」以獲得用戶身份驗證並取回cookie。只是不知道該怎麼做。這是我有,但我得到一個404錯誤:
class AlmActiveResource < ActiveResource::Base
attr_accessor :lwsso_cookie, :qcsession_cookie
self.site = "http://alm_url/qcbin/"
self.user = "name"
self.password = "pw"
def self.authentication
@auth_point = "authentication-point/authenticate"
self.prefix(@auth_point)
meow = self.get(:authenticate)
Rails.logger.debug("Meow: #{meow.inspect}")
end
end
瘋狂道具!謝謝。 – ScottJShea 2012-02-24 00:10:47