Module: CookieJar
- Included in:
- RequestHelper
- Defined in:
- lib/cookie_jar.rb
Instance Method Summary collapse
Instance Method Details
#get_cookies ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cookie_jar.rb', line 2 def params = {:login => @username, :password => @password} = nil RestClient.post("https://#{@server}/login/login", params) do |response, request, result, &block| if response.code == 200 = response. elsif response.code == 302 && response.headers[:location] !~ /login/ = response. else raise "Failed to authenticate" end end end |