Class: Watobo::HTTP::Cookies

Inherits:
Object
  • Object
show all
Defined in:
lib/watobo/http/cookies/cookies.rb

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Cookies

Returns a new instance of Cookies.



60
61
62
63
# File 'lib/watobo/http/cookies/cookies.rb', line 60

def initialize(root)
   @root = root

end

Instance Method Details

#has_parm?(parm_name) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/watobo/http/cookies/cookies.rb', line 35

def has_parm?(parm_name)
  false
end

#parameters(&block) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/watobo/http/cookies/cookies.rb', line 39

def parameters(&block)
  parms = []
  cookie_list=[]
  cookie_prefs={ :secure => false, :http_only => false }
  @root.headers.each do |line|
    if line =~ /^(Set\-)?Cookie2?: (.*)/i then
      cookie_prefs[:secure] = true if line =~ /secure/i
    cookie_prefs[:http_only] = true if line =~ /httponly/i
      clist = $2.split(";")
      clist.each do |c|
       name, value = c.strip.split("=").map{|v| v.strip}
       puts "NEW COOKIE: #{name} - #{value}"
       cookie_prefs[:name] = name
       cookie_prefs[:value] = value
       cookie_list << Watobo::CookieParameter.new(cookie_prefs)
      end
    end
  end
  return cookie_list
end

#set(parm) ⇒ Object



31
32
33
# File 'lib/watobo/http/cookies/cookies.rb', line 31

def set(parm)
 
end

#to_sObject



26
27
28
# File 'lib/watobo/http/cookies/cookies.rb', line 26

def to_s
  s = @root.url_string
end