Class: GrabzIt::CookieJar

Inherits:
Object
  • Object
show all
Defined in:
lib/grabz_it/cookie_jar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ CookieJar

Returns a new instance of CookieJar.



5
6
7
8
9
10
11
12
13
14
# File 'lib/grabz_it/cookie_jar.rb', line 5

def initialize(xml)
  @cookies = []
  doc = REXML::Document.new(xml)
  @message = doc.root.elements['Message'].text
  begin
    add_cookies(doc.root.elements.to_a("//WebResult/Cookies/Cookie"))
  rescue => ex
    raise "Invalid Response: #{xml}"
  end
end

Instance Attribute Details

#cookiesObject

Returns the value of attribute cookies.



3
4
5
# File 'lib/grabz_it/cookie_jar.rb', line 3

def cookies
  @cookies
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/grabz_it/cookie_jar.rb', line 3

def message
  @message
end