Sha256: 98c18b4fe62a5484e006401dce6f95a8debc96981fe79e513bb411acf378ff83

Contents?: true

Size: 548 Bytes

Versions: 16

Compression:

Stored size: 548 Bytes

Contents

class HTTParty::CookieHash < Hash #:nodoc:

  CLIENT_COOKIES = %w{path expires domain path secure HTTPOnly}

  def add_cookies(value)
    case value
    when Hash
      merge!(value)
    when String
      value.split('; ').each do |cookie|
        array = cookie.split('=',2)
        self[array[0].to_sym] = array[1]
      end
    else
      raise "add_cookies only takes a Hash or a String"
    end
  end

  def to_cookie_string
    delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ")
  end
end

Version data entries

16 entries across 15 versions & 5 rubygems

Version Path
alloy_sdk-0.1.0 vendor/bundle/ruby/3.0.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
alloy_sdk-0.1.0 vendor/bundle/ruby/2.6.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.9 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.8 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.7 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.6 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.5 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.4 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.3 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.2 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
allegro_api_client-0.0.1 gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb
httparty-0.13.1 lib/httparty/cookie_hash.rb
yoyle439587298-0.13.0 lib/httparty/cookie_hash.rb
httparty-0.13.0 lib/httparty/cookie_hash.rb
httparty-0.12.0 lib/httparty/cookie_hash.rb