Class: Bidi2pdf::Bidi::Commands::SetTabCookie
- Inherits:
-
Object
- Object
- Bidi2pdf::Bidi::Commands::SetTabCookie
- Includes:
- Base
- Defined in:
- lib/bidi2pdf/bidi/commands/set_tab_cookie.rb
Direct Known Subclasses
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#browsing_context_id ⇒ Object
readonly
Returns the value of attribute browsing_context_id.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#http_only ⇒ Object
readonly
Returns the value of attribute http_only.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#same_site ⇒ Object
readonly
Returns the value of attribute same_site.
-
#secure ⇒ Object
readonly
Returns the value of attribute secure.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expiry ⇒ Object
-
#initialize(name:, value:, domain:, browsing_context_id:, path: "/", secure: true, http_only: false, same_site: "strict", ttl: 30) ⇒ SetTabCookie
constructor
A new instance of SetTabCookie.
- #method_name ⇒ Object
- #params ⇒ Object
Methods included from Base
#==, #as_payload, #eql?, #hash, #inspect
Constructor Details
#initialize(name:, value:, domain:, browsing_context_id:, path: "/", secure: true, http_only: false, same_site: "strict", ttl: 30) ⇒ SetTabCookie
Returns a new instance of SetTabCookie.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 19 def initialize(name:, value:, domain:, browsing_context_id:, path: "/", secure: true, http_only: false, same_site: "strict", ttl: 30) @name = name @value = value @domain = domain @path = path @secure = secure @http_only = http_only @same_site = same_site @ttl = ttl @browsing_context_id = browsing_context_id end |
Class Attribute Details
.time_provider ⇒ Object
12 13 14 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 12 def time_provider @time_provider ||= -> { Time.now } end |
Instance Attribute Details
#browsing_context_id ⇒ Object (readonly)
Returns the value of attribute browsing_context_id.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def browsing_context_id @browsing_context_id end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def domain @domain end |
#http_only ⇒ Object (readonly)
Returns the value of attribute http_only.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def http_only @http_only end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def path @path end |
#same_site ⇒ Object (readonly)
Returns the value of attribute same_site.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def same_site @same_site end |
#secure ⇒ Object (readonly)
Returns the value of attribute secure.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def secure @secure end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def ttl @ttl end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
17 18 19 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 17 def value @value end |
Instance Method Details
#expiry ⇒ Object
39 40 41 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 39 def expiry self.class.time_provider.call.to_i + ttl end |
#method_name ⇒ Object
43 44 45 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 43 def method_name "storage.setCookie" end |
#params ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/bidi2pdf/bidi/commands/set_tab_cookie.rb', line 47 def params { cookie: { name: name, value: { type: "string", value: value }, domain: domain, path: path, secure: secure, httpOnly: http_only, sameSite: same_site, expiry: expiry }, partition: { type: "context", context: browsing_context_id } }.compact end |