Class | CookieJar::Cookie |
In: |
lib/cookiejar/cookie.rb
|
Parent: | Object |
Cookie is an immutable object which defines the data model of a HTTP Cookie. The data values within the cookie may be different from the values described in the literal cookie declaration. Specifically, the ‘domain’ and ‘path’ values may be set to defaults based on the requested resource that resulted in the cookie being set.
comment | [R] |
|
comment_url | [R] |
|
created_at | [R] |
|
discard | [R] |
|
domain | [R] |
|
http_only | [R] |
|
name | [R] |
|
path | [R] |
|
ports | [R] |
|
secure | [R] |
|
value | [R] |
|
version | [R] |
|
Compute the cookie search domains for a given request URI This will be the effective host of the request uri, along with any possibly matching dot-prefixed domains
@param request_uri [String, URI] address being requested @return [Array<String>] String domain matches
Create a cookie based on an absolute URI and the string value of a ‘Set-Cookie’ header.
@param request_uri [String, URI] HTTP/HTTPS absolute URI of request. This is used to fill in domain and port if missing from the cookie, and to perform appropriate validation. @param set_cookie_value [String] HTTP value for the Set-Cookie header. @return [Cookie] created from the header string and request URI @raise [InvalidCookieError] on validation failure(s)
Create a cookie based on an absolute URI and the string value of a ‘Set-Cookie2’ header.
@param request_uri [String, URI] HTTP/HTTPS absolute URI of request. This is used to fill in domain and port if missing from the cookie, and to perform appropriate validation. @param set_cookie_value [String] HTTP value for the Set-Cookie2 header. @return [Cookie] created from the header string and request URI @raise [InvalidCookieError] on validation failure(s)
Given a Hash representation of a JSON document, create a local cookie from the included data.
@param [Hash] o JSON object of array data @return [Cookie] cookie formed from JSON data
Indicates whether the cookie is currently considered valid
@param [Time] time to compare against, or ‘now’ if omitted @return [Boolean]
Evaluate when this cookie will expire. Uses the original cookie fields for a max age or expires
@return [Time, nil] Time of expiry, if this cookie has an expiry set
Indicates whether the cookie will be considered invalid after the end of the current user session @return [Boolean]
Determine if a cookie should be sent given a request URI along with other options.
This currently ignores domain.
@param uri [String, URI] the requested page which may need to receive this cookie @param script [Boolean] indicates that cookies with the ‘httponly’ extension should be ignored @return [Boolean] whether this cookie should be sent to the server
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