Class: Foobara::CommandConnectors::Http::Cookie

Inherits:
Object
  • Object
show all
Defined in:
foobara-http-command-connector-0.0.23/src/http/cookie.rb

Constant Summary collapse

ALLOWED_OPTIONS =
%i[path httponly secure same_site domain expires max_age].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, **opts) ⇒ Cookie

Returns a new instance of Cookie.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'foobara-http-command-connector-0.0.23/src/http/cookie.rb', line 9

def initialize(name, value, **opts)
  invalid_options = opts.keys - ALLOWED_OPTIONS

  unless invalid_options.empty?
    # :nocov:
    raise ArgumentError, "Invalid options #{invalid_options.inspect} expected only #{ALLOWED_OPTIONS.inspect}"
    # :nocov:
  end

  self.name = name
  self.value = value
  self.opts = opts.transform_keys(&:to_sym)
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'foobara-http-command-connector-0.0.23/src/http/cookie.rb', line 5

def name
  @name
end

#optsObject

Returns the value of attribute opts.



5
6
7
# File 'foobara-http-command-connector-0.0.23/src/http/cookie.rb', line 5

def opts
  @opts
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'foobara-http-command-connector-0.0.23/src/http/cookie.rb', line 5

def value
  @value
end