Class: Dropbox::WebClient::CookieManager
- Inherits:
-
Object
- Object
- Dropbox::WebClient::CookieManager
- Defined in:
- lib/dropbox/web_client/cookie_manager.rb
Overview
Cookie management, this is what will preserve our session
Instance Method Summary collapse
-
#all ⇒ Object
Returns a hash with all collected cookies.
- #clear_cookies ⇒ Object
-
#for_share_options ⇒ Object
Returns a hash with cookies relevant for the
share_optionsaction. -
#initialize ⇒ CookieManager
constructor
A new instance of CookieManager.
- #login_token ⇒ Object
- #take(cookies) ⇒ Object
Constructor Details
#initialize ⇒ CookieManager
Returns a new instance of CookieManager.
6 7 8 |
# File 'lib/dropbox/web_client/cookie_manager.rb', line 6 def initialize end |
Instance Method Details
#all ⇒ Object
Returns a hash with all collected cookies.
16 17 18 |
# File 'lib/dropbox/web_client/cookie_manager.rb', line 16 def all @cookies end |
#clear_cookies ⇒ Object
29 30 31 |
# File 'lib/dropbox/web_client/cookie_manager.rb', line 29 def @cookies = {} end |
#for_share_options ⇒ Object
Returns a hash with cookies relevant for the share_options action.
21 22 23 24 25 26 27 |
# File 'lib/dropbox/web_client/cookie_manager.rb', line 21 def valid_keys = ["bjar", "blid", "forumjar", "forumlid", "gvc", "jar", "l", "lid", "locale", "puc", "t"] all.select do |k, v| valid_keys.include? k end end |
#login_token ⇒ Object
33 34 35 |
# File 'lib/dropbox/web_client/cookie_manager.rb', line 33 def login_token @cookies["t"] end |
#take(cookies) ⇒ Object
10 11 12 13 |
# File 'lib/dropbox/web_client/cookie_manager.rb', line 10 def take() @cookies ||= {} @cookies.merge! end |