Class | CookieJar::Jar |
In: |
lib/cookiejar/jar.rb
|
Parent: | Object |
A cookie store for client side usage.
Look through the jar for any cookies which have passed their expiration date, or session cookies from a previous session
@param session [Boolean] whether session cookies should be expired,
or just cookies past their expiration date.
Given a request URI, return a string Cookie header.Cookies will be in order per RFC 2965 - sorted by longest path length, but otherwise unordered.
@param [String, URI] request_uri the address the HTTP request will be
sent to
@param [Hash] opts options controlling returned cookies @option opts [Boolean] :script (false) Cookies marked HTTP-only will be ignored
if true
@return String value of the Cookie header which should be sent on the
HTTP request
Given a request URI, return a sorted list of Cookie objects. Cookies will be in order per RFC 2965 - sorted by longest path length, but otherwise unordered.
@param [String, URI] request_uri the address the HTTP request will be
sent to
@param [Hash] opts options controlling returned cookies @option opts [Boolean] :script (false) Cookies marked HTTP-only will be ignored
if true
@return [Array<Cookie>] cookies which should be sent in the HTTP request
Given a request URI and a literal Set-Cookie header value, attempt to add the cookie to the cookie store.
@param [String, URI] request_uri the resource returning the header @param [String] cookie_header_value the contents of the Set-Cookie @return [Cookie] which was created and stored @raise [InvalidCookieError] if the cookie header did not validate
Given a request URI and a literal Set-Cookie2 header value, attempt to add the cookie to the cookie store.
@param [String, URI] request_uri the resource returning the header @param [String] cookie_header_value the contents of the Set-Cookie2 @return [Cookie] which was created and stored @raise [InvalidCookieError] if the cookie header did not validate
Given a request URI and some HTTP headers, attempt to add the cookie(s) (from Set-Cookie or Set-Cookie2 headers) to the cookie store. If a cookie is defined (by equivalent name, domain, and path) via Set-Cookie and Set-Cookie2, the Set-Cookie version is ignored.
@param [String, URI] request_uri the resource returning the header @param [Hash<String,[String,Array<String>]>] http_headers a Hash
which may have a key of "Set-Cookie" or "Set-Cookie2", and values of either strings or arrays of strings
@return [Array<Cookie>,nil] the cookies created, or nil if none found. @raise [InvalidCookieError] if one of the cookie headers contained
invalid formatting or data
Return an array of all cookie objects in the jar
@return [Array<Cookie>] all cookies. Includes any expired cookies which have not yet been removed with expire_cookies
Return a JSON ‘object’ for the various data values. Allows for persistence of the cookie information
@param [Array] a options controlling output JSON text
(usually a State and a depth)
@return [String] JSON representation of object data