Class: Dropbox::WebClient::CookieManager

Inherits:
Object
  • Object
show all
Defined in:
lib/dropbox/web_client/cookie_manager.rb

Overview

Cookie management, this is what will preserve our session

Instance Method Summary collapse

Constructor Details

#initializeCookieManager

Returns a new instance of CookieManager.



6
7
8
# File 'lib/dropbox/web_client/cookie_manager.rb', line 6

def initialize
  clear_cookies
end

Instance Method Details

#allObject

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_cookiesObject



29
30
31
# File 'lib/dropbox/web_client/cookie_manager.rb', line 29

def clear_cookies
  @cookies = {}
end

#for_share_optionsObject

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 for_share_options
  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_tokenObject



33
34
35
# File 'lib/dropbox/web_client/cookie_manager.rb', line 33

def 
  @cookies["t"]
end

#take(cookies) ⇒ Object



10
11
12
13
# File 'lib/dropbox/web_client/cookie_manager.rb', line 10

def take(cookies)
  @cookies ||= {}
  @cookies.merge! cookies
end